Sunday, 19 May 2019

SORT INCLUDE and OMIT Statements | JCL INCLUDE | JCL OMIT Example.

OMIT JCL
SORT INCLUDE and OMIT statements

In today's tutorial, I will discuss SORT INCLUDE and OMIT control statement. These are very important control statements that are used to improve the efficiency of a SORT job. So, let's start with our tutorial.   

What is JCL INCLUDE and OMIT Statements? 

Every day millions of jobs run on the mainframe to SORT or MERGE data from different files. These jobs use various control statements as per requirements.  INCLUDE and OMIT are two such parameters that are used to improve SORT efficiency and these parameters provide some more processing capabilities. 

The SORT INCLUDE and SORT OMIT statements is used to identify the records that should be included or omitted from the sort or merge process.

The syntax of the INCLUDE and OMIT statements 

INCLUDE COND=(field,comparison,{field   }, [ {AND}, ]…)
                               {constant}    {OR }
OMIT    COND=(field,comparison,{field   }, [ {AND}, ]…)
                               {constant}    {OR }

Important Points: 

  • field:: A field to be used in a comparison. The field is specified as in the SORT or MERGE statement: position, length, format.
  • comparison:: One of these comparison operators:
                 EQ :- Equal        GE Greater than or equal to
                NE :- Not equal LT Less than
               GT :- Greater than LE Less than or equal to
  • constant:: A literal value in one of these formats:
             Decimal         5               +104               -39
            Character      C’CA’      C’JONES’      C’X24'
            Hexadecimal    X’00'       X’F9F9'         X’40404040'
  • AND  and OR :: Operator will be used for include additional conditions.
INCLUDE Example: Include only the records that have an A in byte 1.

//RCTX021D JOB (JOB CARD.....)
//STEP010  EXEC PGM=SORT      
//SYSOUT   DD SYSOUT=*             
//SORTIN   DD DSN=RC01.PAYROL.FILE,DISP=SHR 
//SORTOUT  DD SYSOUT=* 
//SYSIN DD *
  INCLUDE COND=(1,1,CH,EQ,C'A'),
  SORT FIELDS=(1,14,CH,A)
/* 


Include and Omit Examples.


Example 1: INCLUDE only the records with a packed-decimal value in bytes 72-76 that’s greater than or equal to 1000.

INCLUDE COND=(72,5,PD,GE,1000)

Example 2: INCLUDE only the records with a packed-decimal value in bytes 72-76 that’s greater than or equal to 1000 or less than 10.

INCLUDE COND=(72,5,PD,GE,1000,OR,72,5,PD,LT,10)

Example 3: OMIT the records that have an A in byte 1.

OMIT COND=(1,1,CH,EQ,C'A')

No comments:

Post a Comment