View previous topic :: View next topic
|
Author |
Message |
ssk1711
New User
Joined: 16 Jun 2008 Posts: 40 Location: bangalore
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
Bill Dennis
Active Member
Joined: 17 Aug 2007 Posts: 562 Location: Iowa, USA
|
|
|
|
ssk,
enclose 'pdsname(member1)' in quotes otherwise it prepends your userid! |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
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 |
|
|
ssk1711
New User
Joined: 16 Jun 2008 Posts: 40 Location: bangalore
|
|
|
|
thanks. It working now. |
|
Back to top |
|
|
|