How to check if the user typed member is in PDS



IBM's Command List programming language & Restructured Extended Executor

How to check if the user typed member is in PDS

Postby chidams78 » Tue Nov 18, 2008 9:13 pm

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
chidams78
 
Posts: 16
Joined: Fri Sep 19, 2008 6:35 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby chidams78 » Tue Nov 18, 2008 10:56 pm

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
chidams78
 
Posts: 16
Joined: Fri Sep 19, 2008 6:35 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby dick scherrer » Wed Nov 19, 2008 3:30 am

Good to hear it is working - thanks for letting us know :)

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

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

Postby Vadivelmainframe » Sun Mar 15, 2009 11:59 am

I believe LISTDS will help you :)
Vadivelmainframe
 
Posts: 4
Joined: Sun Mar 15, 2009 11:48 am
Has thanked: 0 time
Been thanked: 0 time

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

Postby Twishamis Ray » Tue Feb 09, 2010 1:37 pm

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
Twishamis
User avatar
Twishamis Ray
 
Posts: 5
Joined: Tue Feb 09, 2010 10:46 am
Has thanked: 0 time
Been thanked: 0 time

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

Postby dick scherrer » Wed Feb 10, 2010 12:46 am

Hello,

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

\='OK' is when the dataset does not exist - or have i misunderstood?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

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

Postby Twishamis Ray » Wed Feb 10, 2010 10:12 am

You are absolutely correct dick.
It is a mistake :(
Twishamis
User avatar
Twishamis Ray
 
Posts: 5
Joined: Tue Feb 09, 2010 10:46 am
Has thanked: 0 time
Been thanked: 0 time


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post