DFSORT Omit Numeric Tests

DFSORT OMIT: Writing constants DFSORT OMIT: Alphanumeric Tests


OMIT numeric tests are used to ignore the matching condition specified.

(EQ, NUM) to test for numeric, or (NE, NUM) to test for non-numeric.


OMIT COND=(Field1 starting position, Field1 Length, Field1 format, Relational Operator, NUM)

Let’s discuss in detail.

Field1 starting positionStarting position of field1 to be compared
Field1 LengthLength of the field1 to be compared
Field1 format_typeFormat of the field1

FS is a format for the field if want to test for character numeric 
('0'-'9' inevery byte).
ZD format for the field if you want to test for zoned decimal numeric
('0'-'9'in all non-sign bytes; X'F0'-X'F9', X'D0'-X'D9' or X'C0'-X'C9' in the sign byte).
PD is a format for the field if want to test for packed decimal numeric
(0-9for all digits; F, D or C for the sign).
Relation operatorRelational 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
NUM can be used to indicate a test for numeric or non-numeric.


From the below data, filter the records having the ID is not numeric. The ID starts from 1st and ends at 5th column in the file.


********************************* Top of Data **********************************
00002     Srinivas            Employee                                             
test	  test                test
00001     pawan kumar         student                                              
******************************** Bottom of Data ********************************

Input Record Layout:

	05 ID			PIC X(05).
	05 FILLER		PIC X(05).
	05 NAME			PIC X(15).
	05 FILLER		PIC X(05).
	05 FILLER		PIC X(40).


000100 //Jobcard
000500 //**********************************************************************
000600 //*                                                                     
000700 //* SORT TO WRITE NUMBERIC TEST IN OMIT CONDITION                    
000800 //*                                                                     
000900 //**********************************************************************
001100 //STEP01   EXEC PGM=SORT                                                
001300 //SORTIN   DD DSN=MTH.SORT.INPUT,DISP=SHR                      
001800 //SORTOUT  DD SYSOUT=*                                                  
001900 //SYSOUT   DD SYSOUT=*                                                  
002400 //SYSIN    DD *                                                         
002401      OMIT COND=(1,05,FS,NE,NUM)                                      
002410      SORT FIELDS=COPY                                                   
003400 /*                                                                      
****** **************************** Bottom of Data ****************************


********************************* TOP OF DATA **********************************
test	  test                test
******************************** BOTTOM OF DATA ********************************

Explaining Solution:

  1. As a first step, need to get the position of the ID in the file.
  2. 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.
  3. As a second step, need to get the type of the ID.
  4. 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.
  5. Lastly, the job requirement is to ignore the data with the ID as numeric. So the keyword NUM should use to match the condition.
  6. The OMIT condition for the above requirement with all the data gathered is

  7. OMIT COND=(1,05,FS,NE,NUM)

  8. The above condition specifies that ignore the records where the ID is numeric and remaining records will be copied to output file.
  9. The output would have the records where the IDs are not numeric at first 5 positions.

DFSORT OMIT: Writing constants DFSORT OMIT: Alphanumeric Tests