OMIT: Alphanumeric Tests
OMIT: Alphanumeric Tests
Summary
- OMIT can be used to perform arithmetic tests during sorting.
Syntax -
OMIT COND=(Field1 starting position, Field1 Length, Field1 format,
Relational Operator,alphanumeric_char)
Field1 starting position | Starting position of field1 to be compared |
Field1 Length | Length of the field to be compared |
Field1 format_type | Specifies the format of the field1.Use BI for Alphanumeric tests |
Relation operator | Relational operators like GT, EQ, NE, LT etc,.
|
alphanumeric_char | Specifies the alphanumeric character typeThe set of alphanumeric characters are provided below:
|
Example -
Scenario - From the below data, ignore the records having the ID having alphanumeric and only numeric. The ID starts from 1st and ends at 5th column in the file.
Input File - MTH.SORT.INPUT
----+----1----+---2---+---3---+----4----+---5---+---6----+---7---+---8
********************************* Top of Data ******************************
00002 Srinivas Employee
test3 test3 test3
test test test
00001 Pawan kumar Student
******************************** Bottom of Data ****************************
Input Record Layout -
01 INPUT-REC.
05 ID PIC X(05).
05 FILLER PIC X(05).
05 NAME PIC X(15).
05 FILLER PIC X(05).
05 OCCUPATION PIC X(10).
05 FILLER PIC X(40).
JCL -
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
//Job-card
//******************************************************************
//*
//* SORT TO WRITE ALPHANUMERIC TEST IN OMIT CONDITION FOR MIXED
//* NUMERIC CASE
//*
//******************************************************************
//STEP01 EXEC PGM=SORT
//SORTIN DD DSN=MTH.SORT.INPUT,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OMIT COND=(1,05,BI,EQ,MN)
SORT FIELDS=COPY
/*
**************************** Bottom of Data ************************
Output -
----+---1---+---2---+----3----+---4---+----5---+----6---+---7----+----8
********************************* TOP OF DATA ******************************
test test test
******************************** BOTTOM OF DATA ***************************
Explaining Example -
- As a first step, need to get the position of the ID in the file.
- The names starting from 1st position and ends at 5th position as per the input record layout provided. So the length of ID field is 5.
- As a second step, need to get the type of the ID.
- From the Input record layout declaration, ID field is alpha-numeric. For aplhanumeric tests, use BI instead of the actual field type.
- Lastly, the job requirement is to ignore the data with the ID having alphanumeric and only numeric. So the keyword MN should use to match the condition.
- The OMIT condition for the above requirement with all the data gathered is
OMIT COND=(1,05,BI,EQ,MN)
- The above condition specifies that ignore the records where the ID is combination of alphanumeric and only numeric. Records having alphabetic will be copied to output file.
- The output would have the records where the IDs are not having alphanumeric and only numeric at first 5 positions.