Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to read all the members in a PDS

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: How to read all the members in a PDS
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: 8593
Location: Back in jolly old England

PostPosted: Tue Jun 12, 2007 9:03 pm    Post subject:
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

Moderator Team Head


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

PostPosted: Tue Jun 12, 2007 9:09 pm    Post subject: Re: How to read all the members in a PDS
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

Moderator


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

PostPosted: Wed Jun 13, 2007 11:51 am    Post subject:
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

Moderator


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

PostPosted: Wed Jun 13, 2007 12:19 pm    Post subject:
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    Post subject: Re: How to read all the members in a PDS
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    Post subject: Reply to: How to read all the members in a PDS
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

Moderator Team Head


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

PostPosted: Tue Apr 22, 2008 8:20 pm    Post subject: Re: Reply to: How to read all the members in a PDS
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    Post subject: How get all the members into a PS.....
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts CICS VSAM RLS READ akodakka CICS 3 Tue Oct 04, 2016 3:09 pm
No new posts Multi row fetch - "for read only... Nileshkul DB2 3 Sun Aug 14, 2016 12:52 am
No new posts Single step utility for compare and u... ramprakashn JCL & VSAM 5 Fri Apr 29, 2016 3:43 pm
No new posts To read from Zeke scheduler p.anbuselvan CLIST & REXX 5 Thu Mar 31, 2016 1:13 am
No new posts How to read a excel sheet and load it... Radhika Nambiar Java & MQSeries 10 Wed Mar 30, 2016 4:49 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us