Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
Example 2 z/OS DFSORT Application Programming Guide SC23-6878-00 |
|
This example illustrates how you can sort the data records between header records (first records) and trailer records (last records), and modify just the data records or the header, data and trailer records. The CTL2CNTL data set contains:
The input records look like this:
We want to keep the two Header records and the three Trailer records in place and sort the other records by the CH field in positions 1-14. We want to put 'Old' in positions 30-32 of each data record (but not the Header or Trailer records) that has '23' in positions 24-25. We want to put 'First' in positions 35-39 of each record (Header, data and Trailer) that has '23' in positions 24-25. We use HEADER(2) and TRAILER(3) to indicate the first two records and last three records should not be sorted. We use the INREC statement to add 'Old' to data records that have '23' in positions 24-25. INREC applies to the data records, but not to the Header and Trailer records. We use the SORT statement to sort ascending on positions 1-14. We use the OUTFIL statement to add 'First' to Header, data and Trailer records that have '23' in positions 24-25. OUTFIL applies to all of the records. The output records would look like this:
Note that we could use FIRST(2) and LAST(3) instead of HEADER(2) and TRAILER(3). |
Copyright IBM Corporation 1990, 2014
|