• Rajesh A R

F1 for Mainframe

F1 for Mainframe

Tag Archives: justify

SORT – JUSTIFY, SQUEEZE and OVERLAY

27 Tuesday Mar 2012

Posted by rajeshar in SORT

≈ 2 Comments

Tags

justify, mainframe, overlay, SORT, squeeze

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

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