(Originally posted 2009-04-10.)
For whoever got to my blog with this Google search here’s how you sort data without a header:
First you need to be using z/OS DFSORT Release 10 or to have applied the PTFs for UK90013 (July 2008).
Second, the vehicle for doing this is ICETOOL rather than DFSORT itself.
Use the new DATASORT operator. Here’s an example:
If you code
DATASORT FROM(DD1) TO(DD) FIRST(3) USING(CTL1)
and code a CTL1CNTL like
//CTL1CNTL DD * SORT FIELDS=(1,8,CH,A,9,4,BI,D)
ICETOOL will sort everything after the first 3 records, leaving the first 3 records unchanged. (In this case the sorted lines are, obviously, collated on two distinct fields.)
In the CTL1CNTL set of control statements you can code an OUTFIL statement (or several) if you want to. There are some restrictions on what statements you can code in the CTL1CNTL data set (and these are documented here.)
As well as being able to avoid sorting header records (FIRST,FIRST(n),HEADER,HEADER(n)) you can also avoid sorting the last few records with LAST, LAST(n), TRAILER or TRAILER(n).