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
 

 

how to sort a file with header and detail

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: how to sort a file with header and detail
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    Post subject: Re: how to sort a file with header and detail
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    Post subject:
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    Post subject:
Reply with quote

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

http://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    Post subject:
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    Post subject:
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    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