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

Sort a file containing base and addendum records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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:

Use [URL] BBCode for External Links
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top