View previous topic :: View next topic
|
Author |
Message |
oerdgie
New User
Joined: 22 Nov 2007 Posts: 64 Location: Germany
|
|
|
|
Hi folks,
is it possible to extract records to an output file together with data from a previous record ?
Example (input file) :
ROOT 7777 Data
CHILDA XX 1 Data
CHILDA XX 2 Data
CHILDB Data
ROOT 4444 Data
CHILDB Data
ROOT 2222 Data
ROOT 9999 Data
CHILDA XX 1 Data
Now, I'm looking for all CHILDA records containing 'XX' on pos. 8 and the whole data of their root.
Result (output file) :
CHILDA XX 1 Data ROOT 7777 Data
CHILDA XX 2 Data ROOT 7777 Data
CHILDA XX 1 Data ROOT 9999 Data
Any ideas...? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You can use a DFSORT job like the following to do what you asked for:
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
ROOT 7777 Data
CHILDA XX 1 Data
CHILDA XX 2 Data
CHILDB Data
ROOT 4444 Data
CHILDB Data
ROOT 2222 Data
ROOT 9999 Data
CHILDA XX 1 Data
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,4,CH,EQ,C'ROOT'),
PUSH=(18:1,20))
OUTFIL INCLUDE=(1,9,CH,EQ,C'CHILDA XX')
/*
|
|
|
Back to top |
|
|
oerdgie
New User
Joined: 22 Nov 2007 Posts: 64 Location: Germany
|
|
|
|
Hi Frank,
many thanks for your help, your solution works very well !!
Is there an Application Programming Guide available (pdf), where the GRUOP and the push option is described ?
I have only an old Guide...
Many thanks |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
oerdgie wrote: |
Hi Frank,
many thanks for your help, your solution works very well !!
Is there an Application Programming Guide available (pdf), where the GRUOP and the push option is described ?
I have only an old Guide...
Many thanks |
Check this link which explain in detail about the group and many other new functions
www-947.ibm.com/systems/support/storage/software/sort/mvs/ugpf/ |
|
Back to top |
|
|
oerdgie
New User
Joined: 22 Nov 2007 Posts: 64 Location: Germany
|
|
|
|
Many thanks ! |
|
Back to top |
|
|
|