IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

sorting when a record has multiple trailers


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
THINKSRINIII
Warnings : 1

New User


Joined: 09 Jan 2009
Posts: 88
Location: India

PostPosted: Thu Jun 17, 2010 8:06 pm
Reply with quote

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
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Jun 17, 2010 8:24 pm
Reply with quote

Have you considered the possible use of WHEN=GROUP as illustrated in one of your prior topic Group operations: When trailer record repeats multiple times?
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Thu Jun 17, 2010 8:32 pm
Reply with quote

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
View user's profile Send private message
THINKSRINIII
Warnings : 1

New User


Joined: 09 Jan 2009
Posts: 88
Location: India

PostPosted: Thu Jun 17, 2010 8:34 pm
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jun 17, 2010 9:49 pm
Reply with quote

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
View user's profile Send private message
THINKSRINIII
Warnings : 1

New User


Joined: 09 Jan 2009
Posts: 88
Location: India

PostPosted: Thu Jun 17, 2010 9:55 pm
Reply with quote

hi kolusu,

Many thanks.. That solves many of my queries.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top