Readind a PDS using rexx
Moderators: Veera, Moderator Group
Readind a PDS using rexx
Hi all,
I am novice to REXX. Can some one please help me read a file using rexx.I have browse net but could not get proper understanding.
I am novice to REXX. Can some one please help me read a file using rexx.I have browse net but could not get proper understanding.
In TSO/E REXX, files are read from and written to by the EXECIO command.
EXECIO reads data into the data stack, or into a stem variable. You can read all records, or select a certain number. You can directly read a particular record number. As with any langauage, you have to be careful that you don't exceed the adress space storage.
Assuming you have a dataset allocated to the DD name IN, here's a few ways you can read it:
EXECIO reads data into the data stack, or into a stem variable. You can read all records, or select a certain number. You can directly read a particular record number. As with any langauage, you have to be careful that you don't exceed the adress space storage.
Assuming you have a dataset allocated to the DD name IN, here's a few ways you can read it:
Code: Select all
/* REXX READ RECORDS ONE-BY-ONE */
"EXECIO 0 DISKR IN"
DO FOREVER
"EXECIO 1 DISKR IN"
IF RC <> 0 THEN LEAVE
PARSE PULL record
... do something with the record
END
"EXECIO 0 DISKR IN (FINIS"
Code: Select all
/* REXX READ RECORDS INTO A STEM VARIABLE */
"EXECIO * DISKR IN (STEM rec. FINIS"
DO LOOP = 1 TO rec.0
... do something
END
Code: Select all
/* REXX READ 10 (OR LESS) RECORDS INTO A STEM VARIABLE */
"EXECIO 10 DISKR IN (STEM rec. FINIS"
DO LOOP = 1 TO rec.0
... do something
END
I don't quite understand. Do you not know how to allocate a dataset to an application program? You need a member name to be able to read a PDS.
In a job, using JCL, you'd code a DD statement:
In TSO, an ALLOCATE STATEMENT is typically used:
If you're running your REXX exec outside of either environment, then you might be able to use the BPXWDYN routine as well.
In a job, using JCL, you'd code a DD statement:
Code: Select all
//STEPXXXX EXEC PGM=IKJEFT01,PARM='MYEXEC'
...
//IN DD DISP=SHR,DSN=SBC.COBOL.PROGRAM(MEMBER)
...
Code: Select all
ALLOCATE F(IN) DA('SBC.COBOL.PROGRAM(MEMBER)') SHR REUSE
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
you may want to look at this editmacro from an old version of the ISPF Edit Macros manual: ISRMBRS
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page