DFSORT Omit Alphanumeric Tests

DFSORT OMIT: Numeric tests DFSORT OMIT: Substring search

Advertisements


OMIT can be used to perform arithmetic tests during sorting.

Syntax:

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

Let’s discuss in detail.

nameDescription
Field1 starting positionStarting position of field1 to be compared
Field1 LengthLength of the field to be compared
Field1 format_typeSpecifies the format of the field1.
Use BI for Alphanumeric tests
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
alphanumeric_charSpecifies the alphanumeric character type
The set of alphanumeric characters are provided below:
UC: Uppercase characters (A-Z)
LC: Lowercase characters (a-z)
MC: Mixed case characters (A-Z, a-z)
UN: Uppercase and numeric characters (A-Z, 0-9)
LN: Lowercase and numeric characters (a-z, 0-9)
MN: Mixed case and numeric characters (A-Z, a-z, 0-9)

Example:

From the below data, ignore the records having the ID is combination of alphanumeric and only numeric and the ID starts from 1st and ends at 5th column in the file.


Input: MTH.SORT.INPUT

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
00002     Srinivas            Employee                                           
test3     test3               test3
test      test                test
00001     Pawan kumar         Student                                            
******************************** Bottom of Data ********************************


Input Record Layout:

01 INPUT-REC.
	05 ID			PIC X(05).
	05 FILLER		PIC X(05).
	05 NAME			PIC X(15).
	05 FILLER		PIC X(05).
	05 OCCUPATION 		PIC X(10).
	05 FILLER		PIC X(40).

Job:

000100 //Jobcard
000400 //*                                                                     
000500 //**********************************************************************
000600 //*                                                                     
000700 //* SORT TO WRITE ALPHANUMERIC TEST IN OMIT CONDITION FOR MIXED      
000710 //* NUMERIC CASE                                                        
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,BI,EQ,MN)                                       
002410      SORT FIELDS=COPY                                                   
003400 /*                                                                      
****** **************************** Bottom of Data ****************************

Output:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* 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 IDfield 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. For alpha-numeric test, use BI instead of the actual field type.
  5. Lastly, the job requirement is to ignore the data with the ID as combination of alphanumeric and only numeric. So the keyword MN 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,BI,EQ,MN) 

  8. The above condition specifies that ignore the records where the ID iscombination of alphanumeric and only numeric and remaining records copied to output file.
  9. The output would have the records where the IDs are not combination of alphanumeric and only numeric at first 5 positions.

DFSORT OMIT: Numeric tests DFSORT OMIT: Substring search

Advertisements