|
|
| Author |
Message |
teethu thomas
New User
Joined: 17 May 2007 Posts: 29 Location: India
|
|
|
|
| Can some one explain me how to read each and every member in a PDS. We know only the PDS name and the PDS have some 100 members. We need to process each and every member in a PDS. |
|
| Back to top |
|
 |
References
|
Posted: Tue Jun 12, 2007 8:55 pm Post subject: Re: How to read all the members in a PDS |
 |
|
|
 |
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 2953 Location: Brussels once more ...
|
|
| Back to top |
|
 |
superk
Moderator Team Head
Joined: 26 Apr 2004 Posts: 3096 Location: Charlotte,NC USA
|
|
|
|
1. Print the PDS to a sequential dataset using the IEBPTPCH program or the TSO PRINTDS command. Then, you can read through the entire PDS presented as a single sequential dataset.
2. Use the TSO LISTDS 'pdsname' MEMBERS command. Trap the resulting output into REXX stem variables. In a loop, allocate the PDS and member, and read through the member with EXECIO. In addition to the LISTDS command, you can use the REXX code specified here to generate a member list.
3. Processing a PDS equals using ISPF Library Management (LM) Services. Use the LMINIT and LMMLIST services to allocate the PDS and loop through the members. Use either EXECIO or LMGET to process the PDS member content. The nice thing about this option is that you can perform this in just about any programming language you wish to use.
Examples of any of these processes are abundant throughout these topics. |
|
| Back to top |
|
 |
premkrishnan
Active User
Joined: 07 Sep 2006 Posts: 63 Location: Mars
|
|
|
|
teethu thomas,
Try this code
| Code: |
/*REXX*/
SAY 'ENTER DATASET NAME'
PULL DSN
SYSDSN("'"DSN"'")
"LISTDS '"DSN"' MEMBERS"
|
I am not 100% sure please try anyways. |
|
| Back to top |
|
 |
premkrishnan
Active User
Joined: 07 Sep 2006 Posts: 63 Location: Mars
|
|
|
|
Teethu thomas,
This is a better code than previous.
| Code: |
/*REXX*/
SAY 'Enter a Data Set Name'
PARSE UPPER PULL dsname
IF SYSDSN(dsname) ?= 'OK' THEN DO
say 'DATASET NAME:'dsname
"LISTDS '"DSNAME"' MEMBERS"
RETURN
END
|
Hope this helps. |
|
| Back to top |
|
 |
teethu thomas
New User
Joined: 17 May 2007 Posts: 29 Location: India
|
|
|
|
| Thanx , it is working |
|
| Back to top |
|
 |
harishch_ch
New User
Joined: 07 Jan 2008 Posts: 14 Location: bangalore
|
|
|
|
| Can i assume that the PDS is copied to a PS file from the above REXX code? |
|
| Back to top |
|
 |
superk
Moderator Team Head
Joined: 26 Apr 2004 Posts: 3096 Location: Charlotte,NC USA
|
|
|
|
| harishch_ch wrote: |
| Can i assume that the PDS is copied to a PS file from the above REXX code? |
You could, but your assumption would be incorrect. All those programs do is create a list of the members of a PDS.
Your process would have to:
- Create the member list (as shown above).
- Allocate the PDS and member.
- Read each record, and write to the output PS dataset.
- Allocate the PDS and next member.
- Read and write, and so on for all of the members. |
|
| Back to top |
|
 |
satishstar Currently Banned New User
Joined: 14 Mar 2005 Posts: 16
|
|
|
|
Hi,
/*REXX*/
SAY 'ENTER A DATA SET NAME'
PARSE UPPER PULL DSNAME
SAY 'DATASET NAME:'DSNAME
"LISTDS '"DSNAME"' MEMBERS"
RETURN
END
Using the above code i got all the members of PDS to the TSO screen,but my requirement is that i want to have all the members of the PDS written into a PS line by line like below :-
--MEMBERS--
ADD
COMS
LINESPGM
MEMBERS
PANEL2
PASS
REXXPGM
REXXREPL
RPT805TS
RPT805TZ
SATGUDTS
SATSHGUD
SCREEN1
SUBROUT
TRACE
Plz let me know if any.
Thx,
satish |
|
| Back to top |
|
 |
teethu thomas
New User
Joined: 17 May 2007 Posts: 29 Location: India
|
|
|
|
You can use the OUTTRAP functionality to get the members into a stem and then write it into a sample output file. I have attached below a sample code for that.
| Code: |
/*REXX*/
A = OUTTRAP('TEMPVAR.')
"LISTDS '"DSNAME"' MEMBERS"
B = OUTTRAP('OFF')
"ALLOCATE DD(OUTPUT) DA('THEDSN') NEW
SPACE(100 10) TRACKS DSORG(PS) LRECL(40) RECFM(F B)"
"EXECIO * DISKW OUTPUT(STEM TEMPVAR. FINIS"
"FREE DD(OUTPUT)"
EXIT
|
|
|
| Back to top |
|
 |
|
|