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

Sort groups of Records by value in Trailer


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

New User


Joined: 14 Jul 2006
Posts: 93
Location: Chennai,India

PostPosted: Thu Jun 26, 2008 3:19 pm
Reply with quote

Hi,

I have an input file of lrecl 85 and RECFM FB and i need to sort the files based on the % value in the trailer.

The input file looks like

Code:
 NUMBER:125 .....
     125xxxxxxxxxxxxxxxxxxx                xxxxxxxxxxxx  xxx
     125xxxxxxxxxxxxxxxxxxx                xxxxxxxxxxxx  xxx
     125xxxxxxxxxxxxxxxxxxx                xxxxxxxxxxxx  xxx
 125                                                        0000003 12.00%
 NUMBER:129 .....
     129xxxxxxxxxxxxxxxxxxx                xxxxxxxxxxxx  xxx
 129                                                        0050001 02.00%
 NUMBER:130 .....
     130xxxxxxxxxxxxxxxxxxx                xxxxxxxxxxxx  xxx
     130xxxxxxxxxxxxxxxxxxx                xxxxxxxxxxxx  xxx
     130xxxxxxxxxxxxxxxxxxx                xxxxxxxxxxxx  xxx
 130                                                        0087003  3.44%



And the Expected output is

Code:
 NUMBER:129 .....
     129xxxxxxxxxxxxxxxxxxx                xxxxxxxxxxxx  xxx
 129                                                        0050001 02.00%
 NUMBER:130 .....
     130xxxxxxxxxxxxxxxxxxx                xxxxxxxxxxxx  xxx
     130xxxxxxxxxxxxxxxxxxx                xxxxxxxxxxxx  xxx
     130xxxxxxxxxxxxxxxxxxx                xxxxxxxxxxxx  xxx
 130                                                        0087003  3.44%
 NUMBER:125 .....
     125xxxxxxxxxxxxxxxxxxx                xxxxxxxxxxxx  xxx
     125xxxxxxxxxxxxxxxxxxx                xxxxxxxxxxxx  xxx
     125xxxxxxxxxxxxxxxxxxx                xxxxxxxxxxxx  xxx
 125                                                        0000003 12.00%



There wont be any duplicates in the input file and the number of detail records may vary for any account number.The trailer can be identified using the account number from the header. Is it possible with DFSORT to solve the issue or do i need to write a program for this?

Thanks for the help.....

Syam
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Jun 27, 2008 1:32 am
Reply with quote

Syam,

The following DFSORT/ICETOOL JCL will give you the desired results


Code:

//STEP0100 EXEC PGM=ICETOOL 
//TOOLMSG  DD SYSOUT=*       
//DFSMSG   DD SYSOUT=*       
//IN       DD DSN=your input 85 byte lrecl file,DISP=SHR
//T1       DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)     
//OUT      DD SYSOUT=*                                         
//TOOLIN   DD *                                               
  SPLICE FROM(IN) TO(T1) ON(94,8,CH) KEEPNODUPS WITHALL -     
  WITH(1,93) KEEPBASE USING(CTL1)                             
  SORT FROM(T1) USING(CTL2)                                   
//CTL1CNTL DD *                                               
  INREC IFTHEN=(WHEN=INIT,                                     
  PARSE=(%=(ENDBEFR=C'%'),%01=(SUBPOS=6,FIXLEN=6))),           
  IFTHEN=(WHEN=INIT,OVERLAY=(110:%01,UFF,EDIT=(TTTTTT))),     
  IFTHEN=(WHEN=INIT,OVERLAY=(86:SEQNUM,8,ZD,SEQNUM,8,ZD)),     
  IFTHEN=(WHEN=(1,6,CH,EQ,C'NUMBER'),OVERLAY=(94:SEQNUM,8,ZD)),
  IFTHEN=(WHEN=NONE,OVERLAY=(102:SEQNUM,8,ZD,                 
          94:94,8,ZD,SUB,102,8,ZD,M11,LENGTH=8))               
                                                               
  SORT FIELDS=(94,8,CH,A,110,6,CH,D)                           
/*                                                             
//CTL2CNTL DD *                                               
  OPTION EQUALS                                               
  SORT FIELDS=(110,6,CH,A,86,8,CH,A)                           
  OUTFIL FNAMES=OUT,BUILD=(01,85)                             
/*                                                             


Hope this helps...
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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts JCL sort card - get first day and las... JCL & VSAM 9
Search our Forums:

Back to Top