Use an OMIT statement if you do not want all of the input records to appear in the output data sets. The OMIT statement selects the records you do not want to include.
You can specify either an INCLUDE statement or an OMIT statement in the same DFSORT run, but not both.
Syntax:
OMIT COND=(field1 starting position, field1 Length,field1 format_type, Relational Operator, [constant] [field2 starting position, field2 Length,field2 format_type]) |
Syntax discreption below.
name | Description |
---|---|
Field1 starting position | Starting position of field1 to be compared |
Field1 Length | Length of the field1 to be compared |
Field1 format_type | Format of the field1 like CH, PD, BI etc,. |
Relation operator | Relational operators like GT, EQ, NE, LT etc,.
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 |
Constant | hardcoded value which is compared with field1 |
Field2 starting position | Starting position of field2 which is to be compared with Field1 |
field2 Length | Length of field2 which is to be compared with field1 |
Field2 Format_type | Format of the field2 like CH, PD, BI etc,. |
Let see an example below,
Example: Exclude records depending upon condition - OMIT in sort JCL
INPUT FILE:
12345678901234567890 ---> Column KALAIA 123 RASAN SRINIV 198 ASAN KALAIA 023 RASAN REVATH 111 ISAMBATH SRINIV 098 ASAN SANKAR 222 ICHELLA GUNASE 333 ELAN |
Below code is to exclude the records from input file which contains 'SRINIV' at 1st position.
SORT JCL:
//STEP01 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTIN DD DSN=userid.SORT.INPUT.FILE,DISP=SHR ---> Input file //SORTOUT DD DSN=userid.SORT.OUTPUT.FILE, ---> Output file // DISP=(NEW,CATLG,DELETE),UNIT=SYSDA, // SPACE=(CYL,(1,4),RLSE), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=0) //SYSIN DD * SORT FIELDS=COPY OMIT COND=(1,6,CH,EQ,C'SRINIV') ---> Sort statements /* |
When you execute the above JCL, it produces the following result −
OUTPUT FILE:
12345678901234567890 ---> Column KALAIA 123 RASAN KALAIA 023 RASAN REVATH 111 ISAMBATH SANKAR 222 ICHELLA GUNASE 333 ELAN |
Explanation: OMIT COND=(1,6,CH,EQ,C'SRINIV')
Where, 1 - Starting position(column). 6 - Length of field. CH - Represents charater. EQ - Equal to. C'SRINIV' - Contant character value. |
If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!