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 -
CN@@xyz$$
CO@@mn$$
ST@@EA$$
SEQ@@1000
DD@@101$$
CN@@abcd$$
VW@@cfer$$
SEQ@@1001
DD@@100$$
CN@@MN$$
AS@@EA$$
SEQ@@1002
DD@@102$$
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
You can use a DFSORT/ICETOOL 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.
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: