Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

sorting when a record has multiple trailers

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: sorting when a record has multiple trailers
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: 2150
Location: At my coffee table

PostPosted: Thu Jun 17, 2010 8:24 pm    Post subject:
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: 578
Location: USA

PostPosted: Thu Jun 17, 2010 8:32 pm    Post subject:
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.

http://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    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Efficient sorting chandracdac DFSORT/ICETOOL 5 Sat Oct 22, 2016 3:23 am
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm
No new posts Stripping and Sorting of VB file G SRINIVASA RAO SYNCSORT 5 Wed Sep 14, 2016 1:34 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us