OMIT Coding Constants Example


Scenario - From the below data, filter the records not having name 'Srinivas'. The NAME starts from 11th and ends at 28th 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----+----6----+----7--
//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=(11,15,CH,EQ,C'Srinivas')
/*

Output -

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
test      test                test
00001     pawan kumar         student

Explaining Example -

  1. As a first step, need to get the position of the NAME in the file. The NAMEs starting from 11th and ends at 25th column as per the input record layout provided. So the length of NAME field is 15.
  2. As a Second step, need to get the type of the NAME. From the Input record layout declaration, NAME field is alpha-numeric. So the type is character (CH).
  3. Lastly, the job requirement is to ignore the data with the NAME as Srinivas. So the constant is "Srinivas".
  4. OMIT COND=(11,15,CH,EQ,C'Srinivas')
    - specifies that ignore the records where the NAME is Srinivas and remaining records copied to output file.
  5. The output would have the records where the NAMEs are not Srinivas from 11th position.