Tags

, , , , , ,

SORT – INCLUDE and OMIT

Include/Omit are the first statements to be processed in a SORT job, even though you have mentioned statements in any order.

So by using INCLUDE/OMIT, we can remove unnecessary records before doing the sorting/merging or copying. This increases the speed of the process as we may have less number of records to process.

As name suggests, INCLUDE is for including selecting records and OMIT is for omitting unnecessary records. You can perform both inclusion and omission by both INCLUDE/OMIT by using the operator NE (Not equal).

Suppose if you want to include records with first 2 chars as AR, the statements look as below:

INCLUDE COND=(1,2,CH,EQ,C’AR’)

OMIT COND=(1,2,CH,NE,C’AR’)

You can even compare two fields to do omission/inclusion.

Suppose you want omit all the records for which the first 2 bytes is greater than 3rd and 4th byte together. Say 1-2 and 3-4 bytes all are of numeric data.

INCLUDE COND=(1,2,ZD,LE,3,2,ZD)

OMIT COND=(1,2,ZD,GT,3,2,ZD)

As both the fields are of same type, we can make use of FORMAT and write above statements as

INCLUDE COND=(1,2,LE,3,2),FORMAT=ZD

OMIT COND=(1,2,GT,3,2),FORMAT=ZD

For writing constants

  1. Character Strings

    Use the format C’X…X’

    Say you want to include all records with ‘AR’ at first 2 bytes as shown above.

    INCLUDE COND=(1,2,CH,EQ,C’AR’)

NOTE:

If you want to include a single apostrophe in the string, you must specify it as two single apostrophes. For example, O’NEILL must be specified as C’O”NEILL’.

  1. Hexadecimal Strings

    X’yy..yy’

where yy is a pair of hexadecimal digits. For example, X’7FB0′.

  1. Decimal Numbers

    The format for writing a decimal number is:

    n…n or ±n…n

    where n is a decimal digit. Examples are 24, +24, and -24.

    Decimal numbers must not contain commas or decimal points.

Numeric Tests for INCLUDE and OMIT

You can do numeric tests in INCLUDE/OMIT. Suppose you want to include only records with first 5 bytes being numeric.

INCLUDE COND=(1,5,FS,EQ,NUM)

Use NUM to indicate a test for numerics or non-numerics.

Use EQ to test for numerics, or NE to test for non-numerics.

Use FS format for the field if you want to test for character numerics (‘0’-‘9’ in every byte).

Use ZD format for the field if you want to test for zoned decimal numerics (‘0’-‘9′ in all non-sign bytes; X’F0′-X’F9′, X’D0′-X’D9′ or X’C0′-X’C9’ in the sign byte).

Use PD format for the field if you want to test for packed decimal numerics (0-9 for all digits; F, D or C for the sign).

Substring Search for INCLUDE and OMIT

Below is a INCLUDE statement, to include all the records with first 5 bytes as COBOL, CICS, DB2 and VSAM.

INCLUDE COND=(1,5,CH,EQ,C’COBOL’,OR,

1,5,CH,EQ,C’CICS’,OR,

1,5,CH,EQ,C’DB2′,OR,

1,5,CH,EQ,C’VSAM’)

Instead, you can use one of the substring search capabilities of INCLUDE and OMIT to write the statement in a simpler form as:

INCLUDE COND=(1,5,SS,EQ,C’COBOL,CICS ,DB2 ,VSAM ‘)

The length of each string must match the length of the field. Because you are searching for 5 characters, you must add a blank at the end of “VSAM” and “CICS” and 2 blanks at the end of “DB2”, which are each four characters and 3 characters , but not for “COBOL”, which is five characters.

——————————————————————————————————–

In United States, If you would like to Earn Free Stocks, Credit card Points and Bank account Bonuses, Please visit My Finance Blog

——————————————————————————————————–

You may also like to look at:

Working on Mainframes – Is Change to a different technology necessary
Important SQL CODES and ABEND CODES
SORT JOIN – TO JOIN TWO FILES BASED ON A KEY
KNOW YOUR MAINFRAME
REXX – INITIAL SETUP
SAS – SAMPLE PROGRAM
SORT – CONVERT PD to ZD IN DISPLAYABLE FORMAT (ZDF)
SORT – Alphanumeric Tests for INCLUDE and OMIT
SORT – EQUALS Option
SORT – PARSE – REFORMAT VARIABLE FIELDS
SORT – FINDREP, IFTHEN and INREC
SORT – JUSTIFY, SQUEEZE and OVERLAY
SORT – LOOKUP AND CHANGE
SORT – CONVERT PD to ZD and BI to ZD
SORT – OUTREC – TRAN
SORT – OUTREC – INSERT ZEROES, BLANKS, STRINGS
SORT – OUTPUT DATASET DCB (LRECL,RECFM,BLKSIZE)
SORT – INCLUDE and OMIT
SORT – Process Order of CONTROL Statements
SORT – How to use VB dataset (VLSHRT)
SORT – EDIT MASK PATTERNS
SORT – EDIT NUMERIC FIELDS (I,T,S)
SORT – EDIT FIRST AND LAST RECORD
SORT – SYMBOLS
SORT – TO REPLACE A CHAR WITH ANOTHER CHAR – ALTSEQ
SORT – SET RETURN CODE ‘04’ IF OUTPUT FILE IS EMPTY
SORT – INREC, INCLUDE and OMIT
SORT – SKIPREC and STOPAFT
SORT – INREC
SORT – SUM FIELDS
SORT – REMOVE DUPLICATES AND WRITE THEM TO XSUM
DFSORT – Informational and Error Messages
SORT JOIN – UNPAIRED RECORDS INDICATOR
SORT JOIN – TO JOIN TWO FILES BASED ON A KEY
SORT JOB – SIMPLE COPY
SORT TIPS