• Rajesh A R

F1 for Mainframe

F1 for Mainframe

Tag Archives: substring

SORT – INCLUDE and OMIT

26 Monday Mar 2012

Posted by rajeshar in SORT

≈ 1 Comment

Tags

apostrophe, include, mainframe, num, omit, SORT, substring

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

Rate this:

Subscribe

  • Entries (RSS)
  • Comments (RSS)

Archives

  • November 2020
  • July 2020
  • February 2020
  • January 2020
  • September 2019
  • August 2019
  • October 2018
  • April 2018
  • March 2018
  • December 2017
  • October 2017
  • August 2017
  • July 2017
  • June 2017
  • April 2017
  • March 2017
  • February 2017
  • January 2017
  • December 2016
  • May 2016
  • March 2016
  • February 2016
  • January 2016
  • May 2015
  • September 2013
  • August 2013
  • July 2013
  • June 2013
  • May 2013
  • January 2013
  • December 2012
  • November 2012
  • April 2012
  • March 2012
  • February 2012
  • January 2012
  • April 2011
  • March 2011
  • August 2009
  • June 2009
  • April 2009

Categories

  • Azure
  • CA7
  • CICS
  • COBOL
    • Keywords
  • DB2
  • EASYTRIEVE
  • FILEAID
  • FILEMAXX
  • IMS
  • ISPF
  • JCL
  • KNOW YOUR MAINFRAME
  • Mainframe Migration
  • MAINFRAMES
  • Others
  • REXX
  • SDSF
  • SORT
  • Training
  • TSQL
  • VSAM

Meta

  • Register
  • Log in

Create a free website or blog at WordPress.com.

  • Follow Following
    • F1 for Mainframe
    • Join 88 other followers
    • Already have a WordPress.com account? Log in now.
    • F1 for Mainframe
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar