Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
Writing the INCLUDE statement z/OS DFSORT: Getting Started SC23-6880-00 |
||||||||||||||||||||||||||||||
Suppose it is the end of the year and you want to sort, by title, only the books that you need to reorder for the coming year. If the number of copies sold this year for a particular book is greater than the number in stock, you can assume you need to order more copies. An INCLUDE statement that selects only the books you need to order looks like this: Here are the steps for writing this INCLUDE statement:
You can select from the following comparison operators: Figure 1. Comparison
Operators
You can place the SORT statement either before or after the INCLUDE statement. Control statements do not have to be in any specific order. However, it is good documentation practice to code them in the order in which they are processed. For a flowchart showing the order in which all the control statements are processed, see Processing order of control statements.
This sorts the selected subset of the input records by title in ascending order. Table 2 shows the sorted data set.
Suppose
you want to reduce the subset of input records even further,
to sort only the books you need to order from COR publishers. In this
case, two conditions must be true:
To add the second condition, expand the INCLUDE statement by adding a logical AND, and compare the contents of the publisher field to the character string " COR" (see Writing constants for details how to specify constants). Because the publisher field is 4 bytes long, "COR" will be padded on the right with one blank.
Table 3 shows the result.
As another example, you might sort only the books for courses 00032 and 10347 by writing the INCLUDE and SORT statements as follows:
Note: In the
previous example, you cannot substitute C'32'
for C'00032', because character constants are padded on the right
with blanks. DFSORT uses the following rules for padding and truncation:
In
comparisons, the following rules apply:
|
Copyright IBM Corporation 1990, 2014
|