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
 

 

Sorting body of file but keeping the header

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

New User


Joined: 27 Mar 2009
Posts: 13
Location: London, UK

PostPosted: Tue Apr 28, 2009 2:06 pm    Post subject: Sorting body of file but keeping the header
Reply with quote

Hi everyone,
Is anybody able to offer some advice on my problem please?

I am trying to sort an input file which contains one header record and many detail records using SKIPREC=1, in the output I would like to keep the header record in place at the top of the file but am unable to find a way to do this.

File format
Code:
Header Record
Detail 1
Detail 2
Detail... n


sort conditions
Code:
SORT FIELDS=(1,4,BI,A,6,4,BI,A),
SKIPREC=1
SUM FIELDS=NONE


I found a sort usefull tricks .pdf from previous posts and the article 'Keep or remove specific relative records' which led me to try...
Code:
SORT FIELDS=(1,4,BI,A,6,4,BI,A),       
SKIPREC=1                           
SUM FIELDS=NONE               
SUBSET FROM(SORTIN) TO(SORTOUT) INPUT KEEP RRN(1)

... this seems like it should be the solution but there is something I am clearly missing as it doesn't seem to like it.

Thankyou for any help.
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Apr 28, 2009 2:36 pm    Post subject:
Reply with quote

Take a look at the pdf again and look at one of the first tricks - sort detail records between headers and trailers.

THIS is the pdf that I used to find the trick.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Tue Apr 28, 2009 2:39 pm    Post subject:
Reply with quote

Hi,

try this but I'm unable to test this as my DFSORT does not yet support the DATASORT function
Code:
//STEP0001 EXEC PGM=ICETOOL                                     
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                         
//IN       DD *                                                 
Header Record                                                   
Detail 1                                                       
Detail 2                                                       
Detail... n                                                     
//OUT      DD SYSOUT=*                                         
//TOOLIN   DD *                                                 
DATASORT FROM(IN) TO(OUT) HEADER USING(CTL1)                   
/*                                                             
//CTL1CNTL DD *                                                 
  SORT FIELDS=(1,4,BI,A,6,4,BI,A)                               
/*                                                             

Gerry
Back to top
View user's profile Send private message
Richard J

New User


Joined: 27 Mar 2009
Posts: 13
Location: London, UK

PostPosted: Tue Apr 28, 2009 3:01 pm    Post subject:
Reply with quote

The answer was right under my nose all along! Thanks for your help expat and gcicchet. Your suggestions worked like a charm.
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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