Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts ejck thru rexx to multiple jobs insid... Susanta All Other Mainframe Topics 5 Tue Sep 19, 2017 1:39 pm
No new posts PLI - printing from multiple programs Pedro PL/I & Assembler 8 Fri Sep 08, 2017 6:36 am
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Repeat part of record multiple times Learncoholic DFSORT/ICETOOL 4 Tue Aug 29, 2017 11:33 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us