Page 1 of 1

How to check if the user typed member is in PDS

PostPosted: Tue Nov 18, 2008 9:13 pm
by chidams78
Hi,

My reqt is to change the naming standards of a member which the user enters in the CLIST panel.

I will open a PDS which has so many members and will open up any member and will type the REXX macro in command line. First the REXX calls a panel wherein I will type a member to be processed. Then the rexx macro will get the member name and will call the Edit macro for doing the processing to that particular member alone. If I am typing the right member name which resides inside a PDS, it is working perfect. But if I am typing a member name which is not in the PDS, it is giving error
ISRLS131
Invalid member name
Member name "TESTMEM" is invalid or has not been initialized to blanks.


Code is
"ISREDIT MACRO (DVLPRGN)" 
"ISREDIT (OPENPDS) = DATAID"
"ISREDIT (OPENDSN) = DATASET" 
ADDRESS ISPEXEC                                         
"LMINIT DATAID("OPENPDS") DATASET("OPENDSN") ENQ(EXCLU)"
"LMOPEN DATAID("OPENPDS") OPTION(INPUT)"               
"DISPLAY PANEL(PNLTST)"                    /* calling CLIST panel  */
"VPUT (MEM1)    SHARED"                    /* getting the member name feom panel  */
"LMMLIST DATAID("OPENPDS") MEMBER(MEM1) OPTION(LIST) STATS(NO)"      /* error happens here  */
"VIEW DATAID("OPENPDS") MEMBER("MEM1") MACRO(WALKJCL)"
"LMMLIST DATAID("OPENPDS") OPTION(FREE)"     
"LMCLOSE DATAID("OPENPDS")"                   
"LMFREE DATAID("OPENPDS")"                   
EXIT                                         

Could anyone of you please help me regarding this.

Thanks
Chidams

Re: How to check if the user typed member is in PDS

PostPosted: Tue Nov 18, 2008 10:56 pm
by chidams78
Got the solution.
Instead of
"LMMLIST DATAID("OPENPDS") MEMBER(MEM1) OPTION(LIST) STATS(NO)"

I had used "LMMFIND DATAID("OPENPDS") MEMBER("MEM1")"
The Return code 8 states that the member is not found in that PDS.

Thanks
Chidam

Re: How to check if the user typed member is in PDS

PostPosted: Wed Nov 19, 2008 3:30 am
by dick scherrer
Good to hear it is working - thanks for letting us know :)

d

Re: How to check if the user typed member is in PDS

PostPosted: Sun Mar 15, 2009 11:59 am
by Vadivelmainframe
I believe LISTDS will help you :)

Re: How to check if the user typed member is in PDS

PostPosted: Tue Feb 09, 2010 1:37 pm
by Twishamis Ray
Another way to do this is using 'SYSDSN'.
This function returns 'OK' if the dataset is cataloged.

The following code may be helpful,

Say the PDS name is 'ID.PDS.NAME' and the member name is 'MEM1'.

PDS='ID.PDS.NAME'
MEM='MEM1'
PDSMEM=PDS||'('||MEM||')'

IF SYSDSN("'"PDS"'") \= 'OK' THEN
DO
---------------------Code if the member exists--------------------
END
ELSE
DO
---------------Code if the member does not exist-----------------
END

Re: How to check if the user typed member is in PDS

PostPosted: Wed Feb 10, 2010 12:46 am
by dick scherrer
Hello,

Is the pseudo code correct or has it been "flip-flopped"?

\='OK' is when the dataset does not exist - or have i misunderstood?

Re: How to check if the user typed member is in PDS

PostPosted: Wed Feb 10, 2010 10:12 am
by Twishamis Ray
You are absolutely correct dick.
It is a mistake :(