• Rajesh A R

F1 for Mainframe

F1 for Mainframe

Tag Archives: write

REXX – READ, CREATE AND WRITE DATA TO A DATASET

03 Tuesday Apr 2012

Posted by rajeshar in REXX

≈ 2 Comments

Tags

DATASET, DELETE, mainframe, read, rexx, write

REXX – READ, CREATE AND WRITE DATA TO A DATASET

Below Step shows us how to assign a dataset to a DDNAME and read it.

  1. Read the input dataset into an array variable

INPUTPS =’HLQ1.HLQ2.HLQ3.INPUT’

IF SYSDSN(“‘”INPUTPS”‘”) /= ‘OK’ THEN

DO

SAY ‘INPUT FILE ‘ INPUTPS ‘ DOESNOT EXIST’

EXIT(0)

END

“ALLOC DD(INP1) DA(‘”INPUTPS”‘) SHR REUS”

“EXECIO * DISKR INP1 (STEM IN1. FINIS”

SYSDSN – Checks the availability of the File

ALLOC – Allocates the input file to the DD INP1

EXECIO * DISKR – Reads the input file using the DD name INP1 into the array variable IN1.

Please note that IN1.0 contains the record count of the input file.

  1. Creation of the output file

ADDRESS TSO

RPTCTL=’HLQ1.HLQ2.HLQ3.OUTPUT’

ADDRESS TSO

STATUS = SYSDSN(“‘”RPTCTL”‘”)

IF STATUS = ‘OK’ THEN

DO

“DELETE ‘”RPTCTL”‘”

END

“ALLOC FI(XXOUT) DA(‘”RPTCTL”‘) SHR NEW SPACE(50,20)

DSORG(PS) RECFM(F,B) LRECL(200) BLKSIZE(30000)”

DELETE – Deletes the dataset if it is already available

ALLOC – Allocates the file which is assigned to the DD name XXOUT. You can see that all the dataset parameters that define the dataset can be given as provided above.

  1. Writing data to output dataset

“EXECIO” LOT.0 “DISKW XXOUT (STEM LOT.”

“EXECIO 0 DISKW XXOUT (FINIS”

“FREE F(XXOUT)”

The first line writes all the data (Number of lines to be written is present as LOT.0, which specifies the number of array occurrences for the array LOT.) into the DD XXOUT, which is our output file RPTCTL.

The second line is used to mention that the writing is finished.

Once the usage of the file is done, we need to free the DD name, which is done in the third line. This is done so that the DD name can be used for other datasets.

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

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
EASYTRIEVE – A023 ABEND
EASYTRIEVE – SORT and FILE COMPARISION
EASYTRIEVE – Special-name Report Procedures
EASYTRIEVE – REPORT STAEMENT
EASYTRIEVE – Sample Program – Table And Search
EASYTRIEVE – Sample Program – Display Totals and Summary
EASYTRIEVE – Sample Program – Display Employee Data
CA-Easytrieve/Plus – Basics
REXX TOOL # 02 – FSAVE – Save member opened in VIEW mode
REXX TOOL # 01 – O – Open Any Mainframe Element from any ISPF Screen
REXX – INDEX, POS, SUBSTR, COMPARE
REXX – READ THE DSN PROVIDED AS DD IN JCL
REXX – SEND MULTIPLE ARGUMENTS THROUGH JCL
REXX – HOW TO COMPILE YOUR REXX EXEC
REXX – CHANGE UPPER TO LOWER CASE
REXX – GET LAST 4 DAYS FROM GIVEN DATE
REXX – PANEL Definition
REXX – READ, CREATE AND WRITE DATA TO A DATASET
REXX TOOL TO SUBSTITUTE SYMBOLICS IN A PROC

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

Create a free website or 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