IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to read all the members in a PDS


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
teethu thomas

New User


Joined: 17 May 2007
Posts: 24
Location: India

PostPosted: Tue Jun 12, 2007 8:55 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Jun 12, 2007 9:03 pm
Reply with quote

This has been discussed a few times

You could have searched the forum and found ....
http://ibmmainframes.com/viewtopic.php?t=20208&highlight=list+pds+members
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Tue Jun 12, 2007 9:09 pm
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Jun 13, 2007 11:51 am
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Jun 13, 2007 12:19 pm
Reply with quote

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
View user's profile Send private message
teethu thomas

New User


Joined: 17 May 2007
Posts: 24
Location: India

PostPosted: Wed Jun 13, 2007 12:20 pm
Reply with quote

Thanx , it is working
Back to top
View user's profile Send private message
harishch_ch

New User


Joined: 07 Jan 2008
Posts: 27
Location: bangalore

PostPosted: Tue Apr 22, 2008 6:42 pm
Reply with quote

Can i assume that the PDS is copied to a PS file from the above REXX code?
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Tue Apr 22, 2008 8:20 pm
Reply with quote

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
View user's profile Send private message
satishstar
Currently Banned

New User


Joined: 14 Mar 2005
Posts: 15

PostPosted: Wed Apr 23, 2008 2:57 pm
Reply with quote

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
View user's profile Send private message
teethu thomas

New User


Joined: 17 May 2007
Posts: 24
Location: India

PostPosted: Thu Apr 24, 2008 9:58 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Random read in ESDS file by using RBA JCL & VSAM 6
No new posts Duplicate several members of/in one l... JCL & VSAM 7
No new posts VSAM return code 23 - for a Random read COBOL Programming 4
No new posts ICETOOL to Read records SMF CEF it is... DFSORT/ICETOOL 4
Search our Forums:

Back to Top