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

how to sort a file with header and detail


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

New User


Joined: 10 Mar 2005
Posts: 81

PostPosted: Wed Jun 27, 2007 9:55 am
Reply with quote

I need to sort a file having header and detail records

Input File

H--> Header
AAAM090112345
AAAM090112342
AAAM090112341
H--> Header
BBBM090112325
BBBM090112326
BBBM090112321

Output should be (it should have header with detail records sorted)
H--> Header
AAAM090112341
AAAM090112342
AAAM090112345
H--> Header
BBBM090112321
BBBM090112325
BBBM090112326

How can this be done using ICETOOL
Back to top
View user's profile Send private message
ibmmainframesyntel

Active User


Joined: 26 Feb 2007
Posts: 126
Location: Chennai

PostPosted: Wed Jun 27, 2007 11:28 am
Reply with quote

hi kalu,
what is the LRECL and RECFM of input file?
And no TRAILER record in the input file,am i correct?
Just for reference.
Back to top
View user's profile Send private message
kalukakkad

New User


Joined: 10 Mar 2005
Posts: 81

PostPosted: Wed Jun 27, 2007 12:36 pm
Reply with quote

LRECL 80 and no trailer
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Jun 27, 2007 1:03 pm
Reply with quote

kalukakkad,
Check the "Sort groups of records" Smart DFSORT Trick at:

www.ibm.com/servers/storage/support/software/sort/mvs/tricks/
Back to top
View user's profile Send private message
kalukakkad

New User


Joined: 10 Mar 2005
Posts: 81

PostPosted: Wed Jun 27, 2007 1:37 pm
Reply with quote

Thanks Krisprems. But how to sort if there is no trailer record.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Jun 27, 2007 4:15 pm
Reply with quote

kalukakkad
As per the i/p specified, the code is as follows.

Code:
//*******************************************************               
//STEP001  EXEC PGM=ICETOOL                                             
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN1      DD *                                                         
H                                                                       
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
AAAM090112345                                                           
AAAM090112342                                                           
AAAM090112341                                                           
H                                                                       
BBBM090112325                                                           
BBBM090112326                                                           
BBBM090112321                                                           
/*                                                                     
//OUT      DD SYSOUT=*                                                 
//TOOLIN   DD *                                                         
 SORT FROM(IN1)  TO(OUT) USING(CP01)                                   
/*                                                                     
//CP01CNTL DD *                                                         
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(903:SEQNUM,8,ZD)),                   
        IFTHEN=(WHEN=(1,1,CH,EQ,C'H'),                                 
                OVERLAY=(903:SEQNUM,8,ZD,911:C'00000000')),             
        IFTHEN=(WHEN=NONE,                                             
                OVERLAY=(911:SEQNUM,8,ZD,                               
                         903:903,8,ZD,SUB,911,8,ZD,M11,LENGTH=8,       
                         911:C'11111111'))                             
        SORT FIELDS=(903,8,ZD,A,911,8,ZD,A,1,13,CH,A)                   
        OUTFIL FNAMES=OUT,BUILD=(1,15)                                 
/*                                                                     


O/P OUT
Code:
----+----1----+
***************
H             
AAAM090112341 
AAAM090112342 
AAAM090112345 
H             
BBBM090112321 
BBBM090112325 
BBBM090112326 


and regarding
Quote:
Thanks Krisprems. But how to sort if there is no trailer record.

you need to understand how the records are handled in groups!
So, check the explanation by Frank @ http://ibmmainframes.com/viewtopic.php?t=21781
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 0
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top