This will require 3 output DD statements
Make all 3 with the same dcb info - sortout will need the same space as the input file, the other 2 will need only 1 track. If the file has hundreds of millions of records, this is not a good solution
After the sort step, run an IEBGENER to concatenate the 3 files into one file HD, OUT, TR.
There is probably a more elegant way, but that quickly came to mind.
On a similar note, if (when this file was designed) the file had a "record type" there would be no issue. If the first byte was a 1 for the hdr, 5 for detail records, and 8 for the trailer, the record type could be the high order "key" on any sort and the details would be in order by whatever key was needed for the detail data.
Thanks a lot that was very useful..
but the sort card u mentioned cannot be used becoz the header and trailer rec cant be distinctly seperated with any key value..
1,4,ch,eq'hedr'------> but i don ve a char equal to hedr in my header rec
same for trailer rec too.. trailer rec is just the count of all the detail rec....
Modify as per your requirement
By using a special key of '0' for the header record, '1' for the data records and '9' for the trailer records before the
regular key, we ensure that the header is first and the trailer is last. The '0' special key is unique and will be sorted
first so it's regular key doesn't matter. Likewise, the '9' special key for the trailer is unique and will be sorted last
so it's regular key doesn't matter. However, since all of the data records have the same special key of '1', they will
be sorted between the header and trailer, and the regular key will determine their order.