View previous topic :: View next topic
|
Author |
Message |
THINKSRINIII Warnings : 1 New User
Joined: 09 Jan 2009 Posts: 88 Location: India
|
|
|
|
hi there,
Could someone help me in sorting an input file based on column 7 to 11 when a record has any number of trailers. So, we must assume the occurrence of the next header as the end of previous record.
Input and output datasets : lrecl 400 FB
Code: |
HEADER1501A
BODY
TRAILER
TRAILER
TRAILER
HEADER1501X
BODY
TRAILER
TRAILER
HEADER1501B
BODY
TRAILER |
output
Code: |
HEADER1501A
BODY
TRAILER
TRAILER
TRAILER
HEADER1501B
BODY
TRAILER
HEADER1501X
BODY
TRAILER
TRAILER
|
Many thanks |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
I think you asked similar question in below post and Kolusu provided solution. You could have used your own post to get the answer.
www.ibmmainframes.com/viewtopic.php?t=49383
Code: |
//SORT01 EXEC PGM=SORT
//SORTIN DD *
HEADER1501A
BODY
TRAILER
TRAILER
TRAILER
HEADER1501X
BODY
TRAILER
TRAILER
HEADER1501B
BODY
TRAILER
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,6,CH,EQ,C'HEADER'),PUSH=(51:7,11))
SORT FIELDS=(51,05,CH,A)
OUTFIL BUILD=(1,50)
/*
//SYSOUT DD SYSOUT=* |
|
|
Back to top |
|
|
THINKSRINIII Warnings : 1 New User
Joined: 09 Jan 2009 Posts: 88 Location: India
|
|
|
|
hi cicsguy,
Indeed, I looked at that post and understood how to group records but need to know how to sort them. I have posted here and looking at the manual as well.
Thanks |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
THINKSRINIII,
why are you stuck so much on the multiple trailers as this is the 3rd post about a similar requirement. Please understand how WHEN=GROUP works. When you use BEGIN=(1,6,CH,EQ,C'HEADER') and it will consider the next 'n' records as 1 group until it finds another record which starts with HEADER. you don't need to use the END keyword here. |
|
Back to top |
|
|
THINKSRINIII Warnings : 1 New User
Joined: 09 Jan 2009 Posts: 88 Location: India
|
|
|
|
hi kolusu,
Many thanks.. That solves many of my queries. |
|
Back to top |
|
|
|