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
 

 

Sort a file containing base and addendum records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
ParagChouguley

Active User


Joined: 03 Feb 2007
Posts: 175
Location: PUNE(INDIA)

PostPosted: Fri Mar 13, 2009 2:18 pm    Post subject: Sort a file containing base and addendum records
Reply with quote

I have flat file which contains a base and addendum records. A byte on a record(at same position) identifies if its a base or addendum record (=0 means base, =1 means addendum) A base can have minimum zero and maximum 9 addendum records. No field on base record tells how many addendum records it carries. I want the file to be sorted on 5 fields which are present on base record. Needless to say that a base record and its corresponding addendum records must remain together.

I'm familiar with some of the sort tricks using sequence numbers. A logic of how to do this would be appriciated. ( as I assume, providing JCL without file is impossible)

Thanks in advance!
Back to top
View user's profile Send private message

Skolusu

Senior Member


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

PostPosted: Fri Mar 13, 2009 10:56 pm    Post subject:
Reply with quote

paragchougley,

You haven't provided us with details, so I came up with the best guess as to how your data looks like and I assumed that your input is FB recfm and 80 byte LRECL. I assumed that you want to sort the 10 bytes on the base record starting from pos 3.

You can very easily push the contents of base records on to the addendum records the new WHEN=GROUP function of DFSORT available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this:


Code:

//STEP0100 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                   
0 Z A Y C E                                                       
1 BLAH - GROUP 1 RECORD 1                                         
1 BLAH - GROUP 1 RECORD 2                                         
1 BLAH - GROUP 1 RECORD 3                                         
1 BLAH - GROUP 1 RECORD 4                                         
0 A C D F E                                                       
1 BLAH - GROUP 2 RECORD 1                                         
1 BLAH - GROUP 2 RECORD 2                                         
0   A C G H                                                       
1 BLAH - GROUP 3 RECORD 1                                         
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                   
  OPTION EQUALS                                                   
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,ZD,EQ,0),PUSH=(81:3,10,ID=8))
  SORT FIELDS=(81,18,CH,A)                                         
  OUTFIL BUILD=(1,80)                                             
/*                                                                 


The output from this job is

Code:

0   A C G H                 
1 BLAH - GROUP 3 RECORD 1   
0 A C D F E                 
1 BLAH - GROUP 2 RECORD 1   
1 BLAH - GROUP 2 RECORD 2   
0 Z A Y C E                 
1 BLAH - GROUP 1 RECORD 1   
1 BLAH - GROUP 1 RECORD 2   
1 BLAH - GROUP 1 RECORD 3   
1 BLAH - GROUP 1 RECORD 4   


If you don't have the July, 2008 PTF installed, ask your System Programmer to install it (it's free).

For complete details on the new WHEN=GROUP and the other new functions available with PTF UK90013, see:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
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 change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm


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