View previous topic :: View next topic
|
Author |
Message |
THINKSRINIII Warnings : 1 New User
Joined: 09 Jan 2009 Posts: 88 Location: India
|
|
|
|
Hi there,
I would like to know how to go about the group operations when a trailer record repeats multiple times. We do not exactly know the number of times trailer is repeated in each record. So, we can take the occurence of next header to the end of the previous record.
i have gone through
ftp.software.ibm.com/storage/dfsort/mvs/sortugpf.pdf
the following example is given there.
Code: |
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'HDR'),
END=(1,3,CH,EQ,C'TRL'),PUSH=(31:ID=1))
OUTFIL INCLUDE=(31,1,CH,NE,C' '),BUILD=(1,3)
|
for example my input looks like below
Code: |
....5...10...15...20...25
header 0
body
body
trailer
header 1
body
body
trailer
trailer
header 1
body
body
trailer
trailer
trailer
header
body
trailer
|
input file is LRECL 120 FB. If pos 15 is '1' then write the entire record in the output LRECL 120 FB.
Expected output
Code: |
....5...10...15...20...25
header 1
body
body
trailer
trailer
header 1
body
body
trailer
trailer
trailer
|
Your help is much appreciated |
|
Back to top |
|
|
THINKSRINIII Warnings : 1 New User
Joined: 09 Jan 2009 Posts: 88 Location: India
|
|
|
|
Based on position 15 on header lines, if it is 1 then copy the entire record to the output. Even if that record(Header/body/trailers) has multiple tailers all the trailers of that record should be in the output dataset.
All the header/Body/trailers will have a single trailer atleast.
But, we must consider the header of the next record to be the end of the previous record. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Srini,
Please review the topic and see if what is here is what you want. Looks like Bill and i were updating at the same time.
Why is the 1-char field indented as additional records are shown?
Note - i've added a "ruler" to the data and i'm not sure the data matches the descripton. Let me know if something needs to be changed,
d |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
As requested - changes are made,
d |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
THINKSRINIII,
Assuming your input is FB recfm and 80 byte LRECL, use the following DFSORT control cards which will give you the desired results.
Code: |
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,6,CH,EQ,C'HEADER'),PUSH=(81:15,1))
OUTFIL BUILD=(1,80),INCLUDE=(81,1,ZD,EQ,1)
//* |
|
|
Back to top |
|
|
THINKSRINIII Warnings : 1 New User
Joined: 09 Jan 2009 Posts: 88 Location: India
|
|
|
|
Many thanks for your time Kolusu.. I am trying to incorporate this solution into the below post where we have used "BEGIN" and "END" to denote a record with ID and Sequence number
ibmmainframes.com/viewtopic.php?t=49220
I will let you the results.
Thanks |
|
Back to top |
|
|
|