Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Combine header fields with a detail record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
dinfeo

New User


Joined: 07 Jun 2012
Posts: 20
Location: India

PostPosted: Tue Jun 12, 2012 6:12 pm    Post subject: Combine header fields with a detail record
Reply with quote

Could you please help on this one along with the above requirement:
For the Same Input file (or records), I want to write only the 'V' records with the three key fields of Header & one field from V record itself,into a separate output file.

Input Record :
=========
Code:
000164319079.010.H.0000XXYYYY.00001.MM/DD/YYYY.MM/DD/YYYY HH:MM:SS. .001000ZZZZ.
000164319079.010.L.00001.000.00000.009. .000000000000.0000000
000164319079.010.M.00001.0000.01.00000000000000.00000000000000.0000000000000.000
000164319079.010.T.00001.001.00001.001.TX001.
000164319079.010.L.00002.006.00600.028. .000000000000.0000000
000164319083.010.H.0000XXYYYY.00001.MM/DD/YYYY.MM/DD/YYYY HH:MM:SS. .001000ZZZZ.
000164319083.010.L.00000.0000000000000000000000000000 .000000000000.0000000
000164319083.010.V.00001.00001.0010000022.1.09999
000164319080.010.H.0000XXYYYY.00001.MM/DD/YYYY.MM/DD/YYYY HH:MM:SS. .001000ZZZZ.
000164319080.010.L.00001.014.02409.038. .000000000000.0000000
000164319080.010.L.00002.006.00600.246. .000000005996.0000000
Output Record :
==========
Code:
XXYYYYMM/DD/YYYY0022000164319083.010.V.00001.00001.0010000022.1.09999
Here 0022 is taken from the V record itself (from position 37 to 40).
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Jun 12, 2012 8:22 pm    Post subject:
Reply with quote

Hello,

Please do not "piggy-back" multiple questions onto an existing topic. You need to start a new topic for a new question.

Your topic will be split, but in the future you may notice the tha add-on is simply deleted with no feedback.
Back to top
View user's profile Send private message
Naish

New User


Joined: 07 Dec 2006
Posts: 82
Location: UK

PostPosted: Tue Jun 12, 2012 9:33 pm    Post subject:
Reply with quote

dinfeo,

Suggest you try it and come back if you are stuck and also post the JCL and the error messages. We all will then collectively help you and resolve issues. Believe me you can do this.
Back to top
View user's profile Send private message
dinfeo

New User


Joined: 07 Jun 2012
Posts: 20
Location: India

PostPosted: Wed Jun 13, 2012 11:39 am    Post subject: Reply to: Combine header fields with a detail record
Reply with quote

Hi Naish,
I have written a COBOL program to do this function (Not sure how to write it in SORT).

I tried using JCL SORT, but do know how to take the key fields from Header and write it to another record. I will try to do some more and will get back to you.

Thank You.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Wed Jun 13, 2012 12:13 pm    Post subject: Reply to: Combine header fields with a detail record
Reply with quote

here for syncsort and in the DFSORT section
there are zillions of examples to achieve what you ask for ...
search for the IFTHEN,PUSH,SELECT,BUILD constructs
and You will find something that' s usable with little modifications
Back to top
View user's profile Send private message
Naish

New User


Joined: 07 Dec 2006
Posts: 82
Location: UK

PostPosted: Wed Jun 13, 2012 2:05 pm    Post subject:
Reply with quote

Hello dinfeo,

There is no need for a COBOL program (at least for what you want here). You just have to tweak the SORT that I gave you in your previous topic.

As enrico had already mentioned please do a search and I am sure you can do it?

A small hint is to add one more IFTHEN and an OMIT COND (if not 'V' - since you don't want other records).

Get back if you are stuck.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jun 13, 2012 2:32 pm    Post subject:
Reply with quote

dinfeo came to the forum for a custom built solution.
you did not give it to him; you actually said 'try to work it out yourself'.
so, he goes to COBOL, which apparently he can use successfully
to accomplish this very complex task.

dinfeo will be back, but not with this thread
= unless of course you provide him with his custom solution =
he will open another thread, with another of these complicated problems,
looking for a custom solution.
Back to top
View user's profile Send private message
dinfeo

New User


Joined: 07 Jun 2012
Posts: 20
Location: India

PostPosted: Wed Jun 13, 2012 2:56 pm    Post subject: Reply to: Combine header fields with a detail record
Reply with quote

Hi Naish, I will try it and get back to you. Thanks for the info.
Back to top
View user's profile Send private message
dinfeo

New User


Joined: 07 Jun 2012
Posts: 20
Location: India

PostPosted: Wed Jun 13, 2012 2:59 pm    Post subject:
Reply with quote

dbzTHEdinosauer,

You are correct. I wanted to write it in sort and make the process simpler than to go with a COBOL. I am not familiar with techniques in SORT, but will surely learn it.
Back to top
View user's profile Send private message
dinfeo

New User


Joined: 07 Jun 2012
Posts: 20
Location: India

PostPosted: Wed Jun 13, 2012 4:33 pm    Post subject:
Reply with quote

Hi,
I am unable to get the data from Header.

INREC IFTHEN=(WHEN=GROUP,BEGIN=(18,1,CH,EQ,C'H'),
PUSH=(473:24,2,475:26,4,479:37,10,489:76,4))
INCLUDE COND=(18,1,CH,EQ,C'V')
SORT FIELDS=COPY
OUTREC FIELDS=(1:24,2,3:26,4,7:37,10,17:38,4,21:1,472)

Output is :
1.000000022.1.090022000164319083.010.V.00001.00001.0010000022.1.09999

It is taking the data only from V record. There seems to be an usage of BUILD option for writing a field from one record to another . But I am not finding the explanation for BUILD syntax.
Back to top
View user's profile Send private message
Naish

New User


Joined: 07 Dec 2006
Posts: 82
Location: UK

PostPosted: Wed Jun 13, 2012 4:49 pm    Post subject:
Reply with quote

dinfeo,

Quote:
It is taking the data only from V record.


Because of this

Quote:
INCLUDE COND=(18,1,CH,EQ,C'V')


Why don't you try this?

Quote:
A small hint is to add one more IFTHEN and an OMIT COND (if not 'V' - since you don't want other records).


and please also READ THIS to get an idea of what BUILD is.
Back to top
View user's profile Send private message
dinfeo

New User


Joined: 07 Jun 2012
Posts: 20
Location: India

PostPosted: Wed Jun 13, 2012 7:15 pm    Post subject:
Reply with quote

INREC IFTHEN=(WHEN=GROUP,BEGIN=(18,1,CH,EQ,C'H'),
PUSH=(473:24,2,475:26,4,479:37,10,489:76,4)),

IFTHEN=(WHEN=INIT,
OVERLAY=(1:24,2,3:26,4,7:37,10,17:76,4,21:1,472))

SORT FIELDS=COPY
OMIT COND=((18,1,CH,EQ,C'H'),OR,
(18,1,CH,EQ,C'L'),OR,
(18,1,CH,EQ,C'T'),OR,
(18,1,CH,EQ,C'A'),OR,
(18,1,CH,EQ,C'M'),OR,
(18,1,CH,EQ,C'D'),OR,
(18,1,CH,EQ,C'N'))

OUTREC FIELDS=(1,492)

But the output is coming as
1.000000022.1.09 1.000000022.1.09 0001.00001.0010000022.1.09999
1.000000026.1.09 1.000000026.1.09 0001.00001.0010000026.1.09999


I tried with different other changes but still couldn't get it.
Back to top
View user's profile Send private message
Naish

New User


Joined: 07 Dec 2006
Posts: 82
Location: UK

PostPosted: Wed Jun 13, 2012 8:11 pm    Post subject:
Reply with quote

dinfeo,
Appreciate that you are trying. But, you should know what GROUP and INIT means and what takes preference when used together. It is detailed in the manual with very good examples.

Try this - (Note that this is just an example)
Code:
//SYSIN    DD   *
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(18,1,CH,EQ,C'H'),
                PUSH=(501:24,2,503:26,4,507:27,10)),
        IFTHEN=(WHEN=(18,1,CH,EQ,C'V'),
                OVERLAY=(516:37,4))

  SORT FIELDS=(501,2,CH,A,503,4,CH,A,507,10,CH,A)

  OUTFIL BUILD=(1:501,2,3:503,4,7:507,10,17:516,4),
          OMIT=(18,1,CH,NE,C'V')

Experts will guide us if there is an efficient way.
Back to top
View user's profile Send private message
dinfeo

New User


Joined: 07 Jun 2012
Posts: 20
Location: India

PostPosted: Thu Jun 14, 2012 12:34 pm    Post subject:
Reply with quote

Hi Naish,

Thank You. I didn't try with OUTFIL BUILD.

When initially i tried with the virtual sort position field I got spaces in the first 16 positions.

But now I am able to get that. Thank You once again.
SORTCARD:
=======
INREC IFTHEN=(WHEN=GROUP,BEGIN=(18,1,CH,EQ,C'H'),
PUSH=(473:24,2,475:26,4,479:37,10,489:76,4)),
IFTHEN=(WHEN=(18,1,CH,EQ,C'V'),
OVERLAY=(489:38,4))

SORT FIELDS=(473,2,CH,A,475,4,CH,A,479,10,CH,A,489,4,CH,A)

OUTFIL BUILD=(1:473,2,3:475,4,7:479,10,17:489,4,21:1,472),
OMIT=(18,1,CH,NE,C'V')

Output:
=====
07615503/28/20120022000164319083.010.V.00001.00001.0010000022.1.09999
07615503/28/20120026000164319083.010.V.00001.00001.0010000026.1.09999


Thank You once again Naish, Bill & dbzTHEdinosauer.
Back to top
View user's profile Send private message
Naish

New User


Joined: 07 Dec 2006
Posts: 82
Location: UK

PostPosted: Thu Jun 14, 2012 2:52 pm    Post subject:
Reply with quote

Glad that you got it working. Thanks for letting us know. And could you try and use the code tags next time when you post JCL, etc?
Back to top
View user's profile Send private message
dinfeo

New User


Joined: 07 Jun 2012
Posts: 20
Location: India

PostPosted: Thu Jun 14, 2012 4:27 pm    Post subject: Reply to: Combine header fields with a detail record
Reply with quote

Ok Sure.
Back to top
View user's profile Send private message
dinfeo

New User


Joined: 07 Jun 2012
Posts: 20
Location: India

PostPosted: Thu Jun 14, 2012 5:08 pm    Post subject: Reply to: Combine header fields with a detail record
Reply with quote

Hi Naish,
Made the two requirements under one sort card:
1) To Sort the entire file and write into one file.
2) To Write only required V record on required format.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Jun 14, 2012 6:55 pm    Post subject:
Reply with quote

Hello,

Please do not post "screenshots" - they take more space and are somewhat cluttered in appearance.

The Code tag will preserve alignment and improve readability. Code'd text appears green on black (like many terminals). There is a Preview function so you can see your post as it will appear to the forum. When you have it looking as you want, Submit.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us