|
|
| Author |
Message |
ssk1711
New User
Joined: 16 Jun 2008 Posts: 28 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 |
|
 |
References
|
Posted: Thu Jun 26, 2008 7:42 pm Post subject: Re: Checking for the presence of a particular member in a PDS |
 |
|
|
 |
superk
Moderator Team Head
Joined: 26 Apr 2004 Posts: 3101 Location: Charlotte,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
Moderator Team Head
Joined: 26 Apr 2004 Posts: 3101 Location: Charlotte,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 User
Joined: 17 Aug 2007 Posts: 247 Location: Iowa, USA
|
|
|
|
ssk,
enclose 'pdsname(member1)' in quotes otherwise it prepends your userid! |
|
| Back to top |
|
 |
Pedro
Senior Member
Joined: 01 Sep 2006 Posts: 322 Location: work
|
|
|
|
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: 28 Location: bangalore
|
|
|
|
| thanks. It working now. |
|
| Back to top |
|
 |
|
|