The records from CN@@ to DD@@ belongs to one particular set. Each set Starts with CN@@ and ends with DD@@ and has only one SEQ@@ record with numeric value. Now, my requirement is to sort based on the value of SEQ@@ records such that the set CN@@ and DD @@ set is not disturbed.
The output file should look as below -
This is a "trick" for adding a group number in positions 85-92. The first group of records starting with CN@@ will be given group number 1. The second group of records starting with CN@@ will be given group number 2. And so on. For more information on the group trick, see the "Include or omit groups of records" and "Sort groups of records" Smart DFSORT Tricks at:
The first OUTFIL statement copies the value in each SEQ@@ record to positions 81-84 and writes the reformatted records to T1.
The second OUTFIL statement writes the reformatted records to T2.
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: