Readind a PDS using rexx

Ask/Clarify the questions on TSO, CLIST & REXX

Moderators: Veera, Moderator Group

Post Reply
Sujit
Member
Posts: 9
Joined: Fri Dec 10, 2010 2:09 am

Readind a PDS using rexx

Post by Sujit » Fri Dec 10, 2010 2:22 am

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. 8)

MrSpock
Active Member
Posts: 273
Joined: Wed Jun 27, 2007 5:37 pm

Post by MrSpock » Fri Dec 10, 2010 5:12 am

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:

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 &#40;FINIS"

Code: Select all

/* REXX READ RECORDS INTO A STEM VARIABLE */
"EXECIO * DISKR IN &#40;STEM rec. FINIS"
DO LOOP = 1 TO rec.0
  ... do something
END

Code: Select all

/* REXX READ 10 &#40;OR LESS&#41; RECORDS INTO A STEM VARIABLE */
"EXECIO 10 DISKR IN &#40;STEM rec. FINIS"
DO LOOP = 1 TO rec.0
  ... do something
END

Sujit
Member
Posts: 9
Joined: Fri Dec 10, 2010 2:09 am

Post by Sujit » Fri Dec 10, 2010 7:39 pm

Thanks Dude 8) .......

But I am not understanding where are we giving the PDS name.
Suppose my pds name is 'sbc.cobol.program'.Where should i put the DSN name to which i am readind that.

Please suggest.

Thanks,
Sujit

MrSpock
Active Member
Posts: 273
Joined: Wed Jun 27, 2007 5:37 pm

Post by MrSpock » Fri Dec 10, 2010 8:05 pm

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:

Code: Select all

//STEPXXXX EXEC PGM=IKJEFT01,PARM='MYEXEC'
...
//IN DD DISP=SHR,DSN=SBC.COBOL.PROGRAM&#40;MEMBER&#41;
...
In TSO, an ALLOCATE STATEMENT is typically used:

Code: Select all

ALLOCATE F&#40;IN&#41; DA&#40;'SBC.COBOL.PROGRAM&#40;MEMBER&#41;'&#41; SHR REUSE
If you're running your REXX exec outside of either environment, then you might be able to use the BPXWDYN routine as well.

Sujit
Member
Posts: 9
Joined: Fri Dec 10, 2010 2:09 am

Post by Sujit » Fri Dec 10, 2010 8:12 pm

Thank You! :!:

Sujit
Member
Posts: 9
Joined: Fri Dec 10, 2010 2:09 am

Post by Sujit » Wed Dec 29, 2010 8:30 pm

Hi Spoc,

I have tried to get the member froma pds a s o/p.I got that but now my reqirement is to search one or more member say 3 or 4 from a particular pds (using rexx)and the output will show as
"mamber name1 : Present"
"member name2 : Present"
etc....

Please suggest.

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Thu Dec 30, 2010 12:32 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.

academyindia4

Topic deleted by Admin

Post by academyindia4 » Thu Jan 21, 2016 10:27 am

<< Content deleted By Admin >>

Post Reply

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



Other References
Mainframe Tools and others