DFSORT Including or omitting records

DFSORT Merge Fields DFSORT Include Statement

Advertisements


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.


Note:

By removing unneeded records with an INCLUDE or OMIT statement before sorting, copying or merging, the speed of the sort, copy or merge can be increased.


Subset of the records can be selected from the input dataset by:


  1. Using INCLUDE control statement to collect wanted records

  2. Using OMIT control statement to exclude unwanted records

  3. Using INCLUDE or OMIT parameter on an OUTFIL statement to collect wanted records or exclude unwanted records, respectively.

  4. Specifying INCLUDE and OMIT parameters on different OUTFIL statements.

Note:

INCLUDE or OMIT statements should not be coded together unless the output datasets are different.


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.


Note:

Logical expression are required to specify more than one conitions in INCLUDE or OMIT.

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:

  1. 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.

  2. Testing a field for “numeric”, “alphanumeric”, “non-numerics” or “nonalphanumerics”.

DFSORT Merge Fields DFSORT Include Statement

Advertisements