| INCLUDE | COND=(logical expression) [ FORMAT=f ] |
ALL | (ALL) |
NONE | (NONE) |
Use an INCLUDE statement if you want only certain records to appear in the output data set. The INCLUDE statement selects the records you want to include.
You can specify either an INCLUDE statement or an OMIT statement in the same DFSORT run, but not both.
COND parameter
The parameter COND may assume 3 values:
Value
|
Description
|
ALL
|
all the records are included
|
NONE
|
no record is included
|
logical expression
|
If the logical expression is true for a given record, the record is included in the output data set.
A logical expression consists of one or more relational conditions.
|
Relational conditions
| p1,m1,fi, | (EQ | NE | GT | GE | LT | LE), (p2,m2,f2 | constant) |
Or, if the FORMAT=f operand is used:
| p1,m2, | (EQ | NE | GT | GE | LT | LE), (p2,m2 | constant) |
Relational conditions can be logically combined, with AND or OR, to form a logical expression.
If they are combined, the following rules apply:
| • | AND statements are evaluated before OR statements unless parentheses are used to change the order of evaluation; expressions inside parentheses are always evaluated first. (Nesting of parentheses is limited only by the amount of storage available.) |
| • | The symbols & (AND) and | (OR) can be used instead of the words. |
Field definition
Comparisons may be grouped in:
The first field in the comparison is specified with:
Facts
|
Description
|
p1
|
the position of the field
|
m1
|
the length of the field
|
f1
|
the format of the data in the field (my be omitted if FORMAT is specified)
|
If a comparison file-to-field is required, the second field is specified using:
Facts
|
Description
|
p2
|
the position of the field
|
mm
|
the length of the field
|
f2
|
the format of the data in the field (my be omitted if FORMAT is specified)
|
otherwise, if a field-to-constant comparison is required, the constant may be specified using:
Format
|
Description
|
Example
|
C'string'
|
character string
|
C'ABC'
|
X'hex value'
|
hexadecimal string
|
H'F1F2'
|
Y'year'
|
year
|
Y'97'
|
+|-number
|
decimal number
|
+256
|
Padding and truncation
In a field-to-field comparison, the shorter compare field is padded appropriately. In a field-to-constant comparison, the constant is padded or truncated to the length of the compare field.
Character and hexadecimal strings are truncated and padded on the right.
The padding characters are:
| • | X'40' For a character string |
| • | X'00' For a hexadecimal string. |
Decimal constants are padded and truncated on the left. Padding is done with zeros in the proper format.
Supported comparisons
The supported field-to-constant comparison are:
Field format
|
Decimal number
|
Character string
|
Hexadecimal String
|
Year string
|
BI
|
yes
|
yes
|
yes
|
|
CH
|
|
yes
|
yes
|
|
CE
|
|
yes
|
yes
|
|
AQ
|
|
yes
|
yes
|
|
ZD
|
yes
|
|
|
|
PD
|
yes
|
|
|
|
FI
|
yes
|
|
|
|
Y2C
|
|
|
|
yes
|
Y2B
|
|
|
|
yes
|
Y2P
|
|
|
|
yes
|
BL
|
yes
|
|
yes
|
|
The supported field-to-field comparison are:
Field format
|
BI
|
CH
|
CE
|
AQ
|
ZD
|
PD
|
FI
|
Y2C
|
Y2B
|
Y2P
|
BL
|
BI
|
yes
|
yes
|
|
|
|
|
|
|
|
|
|
CH
|
yes
|
yes
|
|
|
|
|
|
|
|
|
|
CE
|
|
|
yes
|
|
|
|
|
|
|
|
|
AQ
|
|
|
|
yes
|
|
|
|
|
|
|
|
ZD
|
|
|
|
|
yes
|
yes
|
|
|
|
|
|
PD
|
|
|
|
|
yes
|
yes
|
|
|
|
|
|
FI
|
|
|
|
|
|
|
yes
|
|
|
|
|
Y2C
|
|
|
|
|
|
|
|
yes
|
yes
|
yes
|
|
Y2B
|
|
|
|
|
|
|
|
yes
|
yes
|
yes
|
|
Y2P
|
|
|
|
|
|
|
|
yes
|
yes
|
yes
|
|
BL
|
|
|
|
|
|
|
|
|
|
|
yes
|
|