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

Checking for the presence of a particular member in a PDS


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

New User


Joined: 16 Jun 2008
Posts: 40
Location: bangalore

PostPosted: Thu Jun 26, 2008 7:42 pm
Reply with quote

How to check whether a particular member is present in a PDS.

I checked in the forum and I got that we need to check return value of SYSDSN(pdsname(member)) for the answer.

But SYSDSN() give the return value "DATASET NOT FOUND" for all the members irrespective of their presence.

(note : SYSDSN(pdsname) works well to find whether the PDS is catalogued or not )
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Thu Jun 26, 2008 7:49 pm
Reply with quote

Hmm. Works for me.
Code:

/* REXX */
retcode = SYSDSN('''MY.PDS(MEMBER1)''')
Say retcode
retcode = SYSDSN('''MY.PDS(MEMBER2)''')
Say retcode


If only MEMBER1 is in the PDS, I get
OK
MEMBER NOT FOUND
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Thu Jun 26, 2008 7:57 pm
Reply with quote

Using ISPF Library Management (LM) Services also works well.
Code:

/* REXX */
"ISPEXEC LMINIT DATAID(did) DATASET('MY.PDS') ENQ(SHR)"
"ISPEXEC LMOPEN DATAID("did") OPTION(INPUT)"
"ISPEXEC LMMFIND DATAID("did") MEMBER(MEMBER1) STATS(YES)"
Say rc
"ISPEXEC LMMFIND DATAID("did") MEMBER(MEMBER2) STATS(YES)"
Say rc
"ISPEXEC LMCLOSE DATAID("did")"


If only MEMBER1 is in the PDS, I get
0
8
Back to top
View user's profile Send private message
Bill Dennis

Active Member


Joined: 17 Aug 2007
Posts: 562
Location: Iowa, USA

PostPosted: Fri Jun 27, 2008 1:48 am
Reply with quote

ssk,
enclose 'pdsname(member1)' in quotes otherwise it prepends your userid!
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Fri Jun 27, 2008 4:52 am
Reply with quote

Regarding a previous example:
Code:
/* REXX */
retcode = SYSDSN('''MY.PDS(MEMBER1)''')


The use of multiple single quotes is a source of confusion for some. I like using double quotes to define the constant and then use single quotes within, such as:
Code:
/* REXX */
retcode = SYSDSN("'MY.PDS(MEMBER1)'")
Back to top
View user's profile Send private message
ssk1711

New User


Joined: 16 Jun 2008
Posts: 40
Location: bangalore

PostPosted: Mon Jun 30, 2008 10:23 am
Reply with quote

thanks. It working now.
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 How to copy the -1 version of a membe... TSO/ISPF 4
No new posts Searching for a member but don't know... TSO/ISPF 6
No new posts Looking For a PDS Member Without Open... PL/I & Assembler 10
No new posts Library member auto insert option TSO/ISPF 3
No new posts REXX - Dataset checking in a do forev... CLIST & REXX 6
Search our Forums:

Back to Top