Module 8: JCL Sort & Merge
OMIT Statement
OMIT statement function exactly opposite of INCLUDE statement. INCLUDE and OMIT are mutually exclusive commands. OMIT statement is used to reject records which meets specified conditions. Please refer previous section ‘INCLUDE statement’ to understand what all conditions can be handled with INCLUDE Statement
Syntax:-
Let’s see example:-
Input file:-
Requirement: Copy records that does not have ‘44444’ in position 1 to 5
JCL Code:
Output file:-
Using Date Constant in OMIT statement
In order to deal with conditions which involves date comparison, OMIT statement is provided with few Date constants which can help us to specify and use current date, past date or any future dates.
To specify current date one can use below constants based on the format needed:-
System provided constant | Format of date |
---|---|
DATE1P | +YYYYMMDD |
DATE2P | +YYYYMM |
DATE3P | +YYYYDDD |
- All constants i.e. DATE1P, DATE2P and DATE3P refers to current date, current month and current day of the year respectively
- Past date can be referred by subtracting any number of days from constant i.e. (DATE1P-1 refers to yesterday, DAT1P-2 refers to Day before yesterday and so on). Similarly one can also subtract number of months from DATE2P and days from DATE3P.
- Future date can be referred by adding any number of days to constant i.e. (DATE1P+1 refers to tomorrow, DAT1P+2 refers to Day after tomorrow and so on). Similarly, one can also add number of months from DATE2P and days from DATE3P.
Note: Removing the end letter ‘P’ from date constant will allow us to use date constant as character value i.e. DATE1 equals to C’20190110’
Example 1:-
Input file:
Requirement: Omit those records from copying which has date less than or same as current date (let’s assume current date is 2016-Aug-11)
SYSIN Control card:
Output file:
Example 2:-
Input file:
Requirement: OMIT those records from copying which has date between CURRENT DATE +/- 10 days (let’s assume current date is 2016-Aug-11)
SYSIN Control card:
Output file:
Tip: If input date format is YYYY-MM-DD, use DATE1(-) in place of DATE1.
Example 3:-
Input file:-
Requirement: OMIT those records from copying which has date greater than or same as current date. Here date format is YYYY-MM-DD (let’s assume current date is 2016-Aug-11)
SYSIN Control card:
Output file:
Below are few more requirement which can be addressed using SORT OMIT command:
Requirement 1: OMIT those records from copying which has one of the values (‘STEVE’,’VIJAY’,’SMITH’) in position 6 to 10
SYSIN Control card:
Requirement 2: OMIT those records from copying which has value at position 72-76 greater than or equal to 1000 or less than 10
SYSIN Control card:
Requirement 3: OMIT those records from copying which has valid numeric data in specified fields
SYSIN Control card: