OMIT Numeric Tests Example


Scenario - Filter the records having the ID is not 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
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 *
     OMIT COND=(1,05,FS,NE,NUM)
     SORT FIELDS=COPY
/*

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. But we need the data which is non numeric. So the type is FS.
  3. Lastly, the job requirement is to ignore the data with the ID as numeric. So the keyword NUM should use to match the condition.
  4. OMIT COND=(1,05,FS,NE,NUM)
    - The output would have the records where the IDs are not numeric at first 5 positions.