sort with header - DATASORT

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
anu.slaksh
Member
Posts: 11
Joined: Tue Nov 13, 2007 1:57 pm

sort with header - DATASORT

Post by anu.slaksh » Tue Apr 01, 2008 5:53 pm

i have a file with header in the first line. below given is the layout of my file.

header
12
34
45
23

line one is the header of the file and from the second line my record follows. My requirement is i need to sort the records from the second line and the output should be with the header but in the sorted order
that is,

header
12
23
34
45

can anyone help me out in this?

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Tue Apr 01, 2008 7:36 pm

You can use the technique discussed for the "Sort records between a Header and a Trailer" Smart DFSORT Trick at:

http://www.ibm.com/servers/storage/supp ... vs/tricks/

Just use the part for the header and ignore the part for the trailer.

If you need more specific help, tell me the RECFM and LRECL of your input file, and if the header can be identified by a constant somewhere in the record (e.g. 'header' starting in position 1) or only by the fact that it's the first record.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Tue Jul 29, 2008 11:12 pm

You can do this kind of thing quite easily with the new DATASORT operator of DFSORT's ICETOOL available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008). Here's an example:

Code: Select all

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file
//OUT DD DSN=...  output file
//TOOLIN DD *
DATASORT FROM(IN) TO(OUT) HEADER USING(CTL1)      
/*                                                
//CTL1CNTL DD *                                   
  SORT FIELDS=(1,2,CH,A)   
/*                       
For complete details on the new DATASORT function and the other new functions available with PTF UK90013, see:

www.ibm.com/systems/support/storage/sof ... /mvs/ugpf/
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others