OMIT Numeric tests
Numeric tests are used to evaluate and filter records based on numeric data. These tests can be applied to fields containing numeric values, such as Zoned Decimal (ZD), Packed Decimal (PD), or FS formats. Numeric tests are typically used in the OMIT control statements to exclude records that meet specific numeric conditions.
Syntax -
//SYSIN DD *
SORT FIELDS=COPY
OMIT COND=(field1_starting_position, field1_length, field1_format,
relational_operator, NUM)
/*
field1_starting_position | Specifies the starting position of field1 to be compared |
field1_length | Specifies the length of the field1 to be compared |
field1_format | Specifies the format of the field1.
|
relational_operator | used for condition comparison. The available operators are -
EQ Equal to NE Not equal to GT Greater than GE Greater than or equal to LT Less than LE Less than or equal to |
NUM | can be used to specify a test for numeric or non-numeric. |
Examples -
Scenario1 - Ignore records where a numeric field equals a value.
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(1,5,ZD,EQ,+1000)
/*
Ignores records where the 5-byte zoned decimal field starting at position 1 equals 1000.
Scenario2 - Ignore records where a packed decimal field is not equal to a value.
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(15,6,PD,NE,+10000)
/*
Ignores records where the 6-byte packed decimal field starting at position 15 is not equal to 10000.
Scenario3 - Ignore records where a binary field falls within a range.
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(20,4,BI,GE,+5000,AND,20,4,BI,LE,+10000)
/*
Ignores records where the 4-byte binary field starting at position 20 is between 5000 and 10000.