Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
Any chance that you could reveal the LRECL, RECFM, Position, and length of the key for the input file; the LRECL, RECFM, position, length, and format of the sequence for the output file? A one digit sequence as you have shown would not allow for a very big file. What sort product and version are using?
The first IFTHEN clause adds a ZD sequence number in positions 71-77. The sequence number restarts at 1 each time the key (1-30) changes. So the first record with each key will have sequence number 1.
The second IFTHEN clause starts a new group each time the sequence number is 1 and puts an ID value in positions 71-77 of each record in the group. The ID number starts at 1 and is incremented by 1 for each group. So the records of the first group will have an ID of 1, the records of the second group will have an ID of 2, etc.
The third IFTHEN clause just converts the 7-byte ZD ID to a 4-byte PD ID.
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from: