Tags

, , , , ,

SORT – OUTREC – INSERT ZEROES, BLANKS, STRINGS

Using OUTREC parameter in SORT, you can insert zeroes, blanks or strings in any place you require of the output record.

  1. Insert Zeroes

    Suppose you want to copy first 10 fields then place 10 zeroes and then bytes from 11 to 20 from the input file to output file. Your OUTREC would look like as below.

    OUTREC FIELDS=(1,10,10Z,11,10)

    Where 10Z means 10 Zeroes

  2. Insert Blanks

    Suppose you want to copy first 10 fields then place 10 blanks and then bytes from 11 to 20 from the input file to output file. Your OUTREC would look like as below.

    OUTREC FIELDS=(1,10,10X,11,10)

    Where 10X means 10 Blanks

    The above OUTREC can also be written as below:

    OUTREC FIELDS=(1,10,21:11,10)

    Where 21: would ask the sort to fill the data from 11 to 20 bytes of input into 21 to 30 of the output dataset. SORT will automatically fill in blanks from 11 to 20.

    Specifying c:X as your last field is an easy way to increase the record length of your output records to c bytes. For example, if you want to create 80-byte output records containing the first 30 bytes of your input records padded with blanks, you can use this OUTREC statement:

    OUTREC BUILD=(1,30,80:X)

  3. Insert string

    To insert character strings use the below format

    OUTREC FIELDS=(1,10,C’AT LAST’)

    Here we are inserting the string ‘AT LAST’ once after copying first 10 chars of input record.

    OUTREC FIELDS=(1,10,5C’AT LAST’)

    Here we are inserting the string ‘AT LAST’ five times after copying first 10 chars of input record.

    To insert hexadecimal strings use the below format

    OUTREC FIELDS=(1,10,X’yy..yy’)

    Here we are inserting the string ‘yy..yy’ once after copying first 10 chars of input record.

    OUTREC FIELDS=(1,10,nX’yy..yy’)

    Here we are inserting the string ‘yy..yy’ five times after copying first 10 chars of input record.

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

    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
Advertisement