View previous topic :: View next topic
|
Author |
Message |
Raje1002
New User
Joined: 21 Feb 2009 Posts: 11 Location: India
|
|
|
|
Hi,
I have a CLIST code which will search the given member in a list of libraries given by the user. For example in the code given I have 5 libraries. If the member found in any of the librarie or all the libraries, it will list all the library names. If not it will say "MEMNAME NOT FOUND IN ANY LIBRARY LISTED ABOVE".
CLIST code for this:
==============
The CLIST code is around 75 lines. So I have attached here for your reference.
-----------------------------------------------------------------------------------
In the code starting from the line 27 to 71, the lines were repeated (means it will check in the Library 1 and so on till the end, if member found "SET FOUND = YES" switch will be enabled, else it is NO).
My requirement/need:
=====================
If a user wants to give 100 Library means, it is very difficult for them to edit all the repeated lines mentioned above. Am not aware of the PROC concept in CLIST. So can somebody please help me in writing a PROC for this?
Thanks in advance...
Regards,
Raje1002 |
|
Back to top |
|
|
Raje1002
New User
Joined: 21 Feb 2009 Posts: 11 Location: India
|
|
|
|
For easier reference I'll post the code here!!!
PROC 1 MEMNAME
/* CONTROL LIST MSG CONLIST */
/*********************************************************************/
/*** CLIST: FINDMEM ***/
/*** DESC: FIND MEMBER(S) LISTED IN DATASETS BELOW. ***/
/*** PANEL: NONE ***/
/*** HELP: NONE ***/
/*** NOTE(S): - THE NUMBER OF 'SET LIBNN' MUST EQUAL 'DO WHILE' ***/
/*** - EXAMPLE ON TSO COMMAND LINE: TSO FINDMEM MEMBNAME ***/
/*********************************************************************/
/*--- LOAD LIBRARIES ---*/
SET LIB1 = LIB.DATASET.#01
/*--- JOB/JCL LIBRARIES ---*/
SET LIB2 = LIB.DATASET.#02
/*--- COPY BOOK LIBRARIES ---*/
SET LIB3 = LIB.DATASET.#03
/*--- COBOL SOURCE LIBRARIES ---*/
SET LIB4 = LIB.DATASET.#04
/* CONTROL CARD LIBRARIES ---*/
SET LIB5 = LIB.DATASET.#05
SET CN=0
WRITE *** SEARCHING PDS DATASETS FOR MEMBER &MEMNAME ***
DO WHILE &CN < 5 /*CHANGE TO LAST LIB NUMBER FROM LIB## ABOVE */
SET &CN = &CN + 1
SET &VAR = &&LIB&CN
SET &STATUS = &SYSDSN('&VAR(&MEMNAME)')
IF &CN = 1 THEN DO
IF &STATUS = OK THEN DO
WRITE ===> &MEMNAME FOUND IN &VAR <===
SET FOUND = YES
END
ELSE DO
RETURN
END
END
IF &CN = 2 THEN DO
IF &STATUS = OK THEN DO
WRITE ===> &MEMNAME FOUND IN &VAR <===
SET FOUND = YES
END
ELSE DO
RETURN
END
END
IF &CN = 3 THEN DO
IF &STATUS = OK THEN DO
WRITE ===> &MEMNAME FOUND IN &VAR <===
SET FOUND = YES
END
ELSE DO
RETURN
END
END
IF &CN = 4 THEN DO
IF &STATUS = OK THEN DO
WRITE ===> &MEMNAME FOUND IN &VAR <===
SET FOUND = YES
END
ELSE DO
RETURN
END
END
IF &CN = 5 THEN DO
IF &STATUS = OK THEN DO
WRITE ===> &MEMNAME FOUND IN &VAR <===
SET FOUND = YES
END
ELSE DO
RETURN
END
END
IF &FOUND NE YES THEN DO
WRITE ***> &MEMNAME NOT FOUND IN ANY LIBRARY LISTED ABOVE.<***
END
|
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
AD 2011 you write REXX, not CLIST.
Read about REXX and more specifically about STEMs. |
|
Back to top |
|
|
pmvino
New User
Joined: 22 Aug 2008 Posts: 20 Location: india
|
|
|
|
Have u written the code or copied from net.... The code is REXX.. search more in net and find ur ans... it is so simple.... |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
pmvino wrote: |
Have u written the code or copied from net.... The code is REXX.. search more in net and find ur ans... it is so simple.... |
What are you on about.
The code ahown is CLIST |
|
Back to top |
|
|
Raje1002
New User
Joined: 21 Feb 2009 Posts: 11 Location: India
|
|
|
|
Yeah Its CLIST and I want to know how to write a PROC (Procedure) to make the below lines standard.
"IF &CN = 1 THEN DO
IF &STATUS = OK THEN DO
WRITE ===> &MEMNAME FOUND IN &VAR <===
SET FOUND = YES
END
ELSE DO
RETURN
END
END"
For the next time it will go to the &CN = 2 and wil do the search. Like wise it will go for the "N" number of datasets we have given.
For instance if we have 100 datasets means, I need to repeat the above 9 lines 100 times. I want to pass the CN value thru PROC so that we can minimize the code. Can you please help on this... |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
Raje1002 wrote: |
Yeah Its CLIST
.
.
.
.
Can you please help on this... |
Yes, we told you what to do!
Now go away, rewrite your routine in REXX and only come back if you need help with that! |
|
Back to top |
|
|
Raje1002
New User
Joined: 21 Feb 2009 Posts: 11 Location: India
|
|
|
|
I got the desired code with the help of my Project lead..
Here is the simplified code:
SET CN=0
SET MAX = 100
WRITE *** SEARCHING PDS DATASETS FOR MEMBER &MEMNAME ***
DO CN = 1 TO &MAX BY 1
SET &VAR = &&LIB&CN
SET &STATUS = &SYSDSN('&VAR(&MEMNAME)')
IF &STATUS = OK THEN DO
WRITE ===> &MEMNAME FOUND IN &VAR <===
SET FOUND = YES
END
END
/*
IF &FOUND NE YES THEN DO
WRITE ***> &MEMNAME NOT FOUND IN ANY LIBRARY LISTED ABOVE.<***
END |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Good to hear this is working - Thank you for sharing your solution
d |
|
Back to top |
|
|
|