Tags

, , , ,

SORT – JUSTIFY, SQUEEZE and OVERLAY

 

  1. JUSTIFY

    Using SORT, you can justify your input records.

Suppose you have your input file as below:

(RAJESH/

RAMS/

SUNIL/

SURESH)

And you want your output file in this format

<RAJESH>

<RAMS>

<SUNIL>

<SURESH>

Your SORT card would look like below:

OPTION COPY

OUTREC FIELDS=(1,20,JFY=(SHIFT=LEFT,PREBLANK=C'()/’,

LEAD=C'<‘,TRAIL=C’>’))

JFY is used to justify the input record
SHIFT=LEFT tells that records needs to be shifted to left (SHIFT=RIGHT for right shift)
PREBLANK=C'()/’ tells that the characters ‘(‘, ‘)’ and ‘/’ need to be replaced by blank.
LEAD=C'<‘ tells that all records should be appended with ‘<‘ at start
TRAIL=C’>’ tells that all records should be appended with ‘>’ at end
  1. SQUEEZE

    Using SORT, you can SQUEEZE your input records. That is you can remove unwanted spaces in between in a record.

Suppose you have your input file as below:

A (RAJESH/ A

B RAMS/ B

C SUNIL/ C

D SURESH) D

“E CHIRU ” E

And you want your output file in this format

{A.RAJESH.A}

{B.RAMS.B}

{C.SUNIL.C}

{D.SURESH.D}

Your SORT card would look like below:

OPTION COPY

OUTREC FIELDS=(1,20,SQZ=(SHIFT=LEFT,PREBLANK=C'()/’,MID=C’.’,

LEAD=C'{‘,TRAIL=C’}’))

SQZ is used to squeeze the input record
SHIFT=LEFT tells that records needs to be shifted to left (SHIFT=RIGHT for right shift)
PREBLANK=C'()/’ tells that the characters ‘(‘, ‘)’ and ‘/’ need to be replaced by blank.
LEAD=C'<‘ tells that all records should be appended with ‘<‘ at start
TRAIL=C’>’ tells that all records should be appended with ‘>’ at end
MID=C’.’ MID=string specifies the string to replace removed blanks
PAIR=QUOTE “ignore” blanks and PREBLANK characters between pairs of quotes
PAIR=APOST “ignore” blanks and PREBLANK characters between pairs of apostrophes
  1. OVERLAY

    The OVERLAY parameter of the OUTREC statement can be used if you only want to change one or a few items and keep the rest of the record in its original form

    Suppose you want to change the data present in bytes 6 to 10 to upper case and leave the other part of the data as it is, you can use below OVERLAY.

    OPTION COPY

    OUTREC OVERLAY=(6:6,5,TRAN=LTOU)

 

This will copy the data from bytes 1 to 5 as it is into the output file and convert the chars present in bytes 6 – 10 into upper case.

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

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