OMIT Alphanumeric Tests Example


Scenario - 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 - MATEPK.SORT.INPUT

----+----1----+---2---+---3---+----4----+---5---+---6----+---7---+---8
00002     Srinivas            Employee
test3     test3               test3
test      test                test
00001     Pawan kumar         Student

JCL -

----+----1----+----2----+----3----+----4----+----5----+
//MATEPKD  JOB (123),'MTH',NOTIFY=&SYSUID
//*
//STEP01   EXEC PGM=SORT
//SORTIN   DD DSN=MATEPK.SORT.INPUT,DISP=SHR
//SORTOUT   DD DSN=MATEPK.MERGE.OUTPUT,
//            DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
//            SPACE=(CYL,(1,4),RLSE),
//            DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)
//SYSOUT   DD SYSOUT=*
//SYSIN    DD *
     SORT FIELDS=COPY
     OMIT COND=(1,05,BI,EQ,MN)
/*

Output -

----+---1---+---2---+----3----+---4---+----5---+----6---+---7----+----8
test      test                test

Explaining Example -

  1. 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.
  2. 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.
  3. 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.
  4. OMIT COND=(1,05,BI,EQ,MN)
    - The output would have the records where the IDs are not having alphanumeric and only numeric at first 5 positions.