• Rajesh A R

F1 for Mainframe

F1 for Mainframe

Tag Archives: lookup

SORT – LOOKUP AND CHANGE

27 Tuesday Mar 2012

Posted by rajeshar in SORT

≈ 1 Comment

Tags

change, lookup, mainframe, SORT

SORT – LOOKUP AND CHANGE

You can make use of SORT, to replace a string of the input record with different strings based on the value of that input string.

Suppose you have your input file as below:

DD

PCT

MOVE

INDEX

FILE

And you want to your output to be as below:

DD JCL

PCT CICS

MOVE COBOL

INDEX VSAM

FILE ALL

So here you are relating each keyword in the first 5 bytes of your input file to the language it belongs to.

So your OUTREC statement should look like below.

OUTREC FIELDS=(1,5,X,

1,5,CHANGE=(10,

C’DD’,C’JCL’,

C’PCT’,C’CICS’,

C’MOVE’,C’COBOL’,

C’INDEX’,C’VSAM’),

NOMATCH=(C’ALL’))

You use p, m,CHANGE=(v,find,set,…) to give the position and length of the input field, the length of the output field, and the “table” consisting of pairs of find constants, and set constants or set fields. For example, for the first field in the OUTREC statement above:

  1. The input field starts in position 1.
  2. The length of the input field and find constants is 5.
  3. The length of the output field and set constants is 10.
  4. The first find constant is ‘DD’ (padded with a blank at the end to 5 characters).
  5. The first set constant is ‘JCL’ (padded with blanks at the end to 10 characters).

You can use NOMATCH=(set) to set the output value when an input field value does not match any of the find constants. If you do not specify NOMATCH=(set), DFSORT terminates with an error message when an input field value does not match any of the find constants.

HERE NOMATCH=(C’ALL’) will set the value as ALL for the word FILE in input file as it did not have any matches in CHANGE command.

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

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

  • Create account
  • Log in

Blog at WordPress.com.

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Subscribe Subscribed
    • F1 for Mainframe
    • Join 90 other subscribers
    • Already have a WordPress.com account? Log in now.
    • F1 for Mainframe
    • Subscribe Subscribed
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar