INCLUDE Alphanumeric Tests
INCLUDE Alphanumeric Tests
Alphanumeric tests allow us to filter records based on conditions involving character (alphanumeric) data. These tests are used in the INCLUDE to retain records depending on whether they satisfy specific alphanumeric conditions.
Syntax -
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(field1_starting_position, field1_length, field1_format,
relational_operator, alphanumeric_system_defined_type)
/*
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. Use BI (Binary) for Alphanumeric tests |
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 |
alphanumeric_system_defined_type | Specifies the alphanumeric character type.
The valid types are given below -
UC: Uppercase characters (A-Z) LC: Lowercase characters (a-z) MC: Mixed case characters (A-Z, a-z) UN: Uppercase and numeric characters (A-Z, 0-9) LN: Lowercase and numeric characters (a-z, 0-9) MN: Mixed case and numeric characters (A-Z, a-z, 0-9) |
Examples -
Scenario1 - Include records where a field equals a specific string
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(1,3,CH,EQ,C'ABC')
/*
Includes records where the first 3 bytes equal 'ABC'.
Scenario2 - Include records where a field is equal to alphanumeric value 1234 .
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(5,4,CH,NE,C'1234')
/*
Includes records where the 4-byte field starting at position 5 is equal to 1234.
Scenario3 - Include records where a field falls within a alphanumeric values range.
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(20,6,CH,GE,C'100',AND,20,6,CH,LE,C'200')
/*
Includes records where the 6-byte field starting at position 20 falls within the alphanumeric values range 100 to 200.