DFSORT Including or omitting recordsDFSORT Merge Fields DFSORT Include Statement
What this topic covers?
This topic explains how to include or omit only specific records from the input data set for sorting, copying or merging to the output data set.
Including records can copy the specific set of records which satisfies the condition provided.
In this scenario, only selected records which satisfy the condition specified will be copied to output file.
INCLUDE control statement is used to specify the selection criteria.
Omitting recordscan ignore the specific set of records which satisfies the condition provided.
In this scenario, all records other than the records which satisfy the condition specified will be copied to output file.
EXCLUDE control statement is used to specify the selection criteria.
Note: By removing unneeded records with an INCLUDE or OMIT statement beforesorting, copying or merging, the speed of the sort, copy ormerge can be increased.
Subset of the records can be selected in an input data set by:
- Using an INCLUDE control statement to collect wanted records
- Using an OMIT control statement to exclude unwanted records
- Using an INCLUDE or OMIT parameter on an OUTFIL statement to collect wanted records or exclude unwanted records, respectively.
- Different INCLUDE and OMIT parameters can be used on different OUTFIL statements.
The OUTFIL statement should be used if INCLUDE and OMIT needs to be used in the same SORT step.
The OUTFIL is processed after sorting, copying or merging.
The FORMAT=f parameter couldn’t be used for OUTFIL.
Logical operators AND and OR can be used to combine two or more conditions with logical ANDs and ORs.
INCLUDE and OMIT both offer powerful substring search capabilities.
The recordsselection can be done in below two ways:
- Comparing the contents of a field with another field or a Constant
Another field can be the field in the same file.
A constant can be a character string, a decimal number, ahexadecimal string, or the current date, a future date or a past date.
- Testing a field for “numeric”, “alphanumeric”, “non-numerics”or “nonalphanumerics”.
DFSORT Merge Fields DFSORT Include Statement