It's like this. I have say 1000 records, but I want to start sorting in between, say from 14 rec... . The output file should contain all the records without skipping any of the initial records(first 13) and the sorted ones.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
You mean you want to keep the first 13 records in place and sort the rest?
If so, then you can use a DFSORT job like this. I assumed your input file has RECFM and LRECL=80 and your sort field is a character field in positions 21-28. Change as appropriate:
Is it possible with DFSORT to sort only a few records in between? Say i have the following records from the input file and i want to sort only the records from the 4th record till the 6th record.
Thank You so much Frank.
I got the desired result but, could not completely understand the sort portion...though I tried searching in DFSORT material....
Would be helpful if i could know it.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
I got the desired result but, could not completely understand the sort portion...though I tried searching in DFSORT material....
Would be helpful if i could know it.
Notice that records 1-13 have a unique first sequence number whereas records 14-n all have 99999999 as the first sequence number. The second sequence number is just used by the second IFTHEN clause to tell us when we get to record 13.
Code:
SORT FIELDS=(81,8,ZD,A,11,8,CH,A)
The SORT statements sorts on the first sequence number and then on the actual key. Since we have a sequence number of 1-13 for the first 13 records, they will stay in that sequence. Since we have a sequence number of 99999999 for the rest of the records they will be sorted by the key.
Code:
OUTREC BUILD=(1,80)
The OUTREC statement just removes the sequence numbers.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
skkp2006,
You can use a DFSORT job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
With z/OS DFSORT V1R5 PTF UK90013 (July, 2008), you can now use the new DATASORT operator of DFSORT's ICETOOL to easily keep headers, trailers or headers and trailers in place while you sort the data records between them. For complete details on DATASORT, see: