Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
Example 9 z/OS DFSORT Application Programming Guide SC23-6878-00 |
|
This example shows how you can use USING(xxxx) to supply a SORT
statement to alter the records that are selected.
Let's say the IN data set
looks like this:
We want to select the three records
with each name that have the highest counts. If we just used ON(1,5,CH)
without any CTL1CNTL statements, we'd get the first three records
for each name without regard to the count. The OUT data set would
look like this:
To get the three records with the
highest counts for each name, we can use the following SORT statement
in CTL1CNTL:
The records
will be sorted in ascending order on the name field, and in descending
order on the count field. By sorting descending on the count, we
ensure that the three records with the highest counts
are the first three records for each name. Thus, when ON(1,5,CH) selects
the first three records, they will be those with the highest
counts. The OUT data set will look like this:
|
Copyright IBM Corporation 1990, 2014
|