In this topic, we described about the Including or omitting records with detailed example.
This topic explains how to include or omit only specific records from the input dataset for sorting, copying or merging to the output dataset. 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 records can 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.
Subset of the records can be selected from the input dataset by:
- Using INCLUDE control statement to collect wanted records
- Using OMIT control statement to exclude unwanted records
- Using INCLUDE or OMIT parameter on an OUTFIL statement to collect wanted records or exclude unwanted records, respectively.
- Specifying INCLUDE and OMIT parameters on different OUTFIL statements.
The OUTFIL statement should be coded 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 logically.
INCLUDE and OMIT both offer powerful substring search capabilities. The records selection 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, a hexadecimal string, or the current date, a future date or a past date.
- Testing a field for “numeric”, “alphanumeric”, “non-numerics” or “nonalphanumerics”.