View previous topic :: View next topic |
Author |
Message |
relaxing Beginner
Joined: 25 Aug 2003 Posts: 73 Topics: 29
|
Posted: Thu Dec 16, 2010 11:52 am Post subject: Seqnum Help |
|
|
Hello Gurus,
Could you help me out on this please?
There are multiple block headers with detail records in my file. I need some information from the header onto its detail records.
Quote: | INPUT:
HDR1.......34
HDR2...
Det1
Det2
Det3
EOF2
EOF1
HDR1........45
HDR2...
Det1
Det2
Det3
EOF2
EOF1 |
Quote: | Output:
HDR1.......34
HDR2...
Det134
Det234
Det334
EOF2
EOF1
HDR1........45
HDR2...
Det145
Det245
Det345
EOF2
EOF1 |
Regards, |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Thu Dec 16, 2010 11:58 am Post subject: |
|
|
relaxing,
Assuming your input is FB and LRECL of 80, the following DFSORT JCL will give you the desired results. I also assumed that your each group is identified by 'hdr1' in first 4 bytes.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
----+----1----+----2----+----3----+----4----+----5----+----6---
HDR1.......34
HDR2...
DET1
DET2
DET3
EOF2
EOF1
HDR1.......45
HDR2...
DET1
DET2
DET3
EOF2
EOF1
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFOUTLEN=80,
IFTHEN=(WHEN=GROUP,BEGIN=(1,4,CH,EQ,C'HDR1'),PUSH=(81:12,2)),
IFTHEN=(WHEN=(1,3,SS,NE,C'HDR,EOF'),OVERLAY=(5:81,2))
//* |
_________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
relaxing Beginner
Joined: 25 Aug 2003 Posts: 73 Topics: 29
|
Posted: Thu Dec 16, 2010 12:16 pm Post subject: |
|
|
Thanks a lot Kolusu...I was not even aware of GROUP and PUSH ! |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
relaxing Beginner
Joined: 25 Aug 2003 Posts: 73 Topics: 29
|
Posted: Thu Dec 16, 2010 12:30 pm Post subject: |
|
|
Thanks Kolusu. |
|
Back to top |
|
 |
relaxing Beginner
Joined: 25 Aug 2003 Posts: 73 Topics: 29
|
Posted: Thu Dec 23, 2010 1:27 pm Post subject: |
|
|
Kolusu, my second step is to extract only detail records. I have done a simple include condition to do this but was wondering if it could be done in the same step |
|
Back to top |
|
 |
relaxing Beginner
Joined: 25 Aug 2003 Posts: 73 Topics: 29
|
Posted: Thu Dec 23, 2010 1:42 pm Post subject: |
|
|
Kolusu, I just realized we could use outfil include to do this in one step. |
|
Back to top |
|
 |
|
|