Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to create PROC in CLIST?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Raje1002

New User


Joined: 21 Feb 2009
Posts: 11
Location: India

PostPosted: Mon Jan 24, 2011 11:29 am    Post subject: How to create PROC in CLIST?
Reply with quote

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
View user's profile Send private message

Raje1002

New User


Joined: 21 Feb 2009
Posts: 11
Location: India

PostPosted: Mon Jan 24, 2011 12:09 pm    Post subject:
Reply with quote

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
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1060
Location: Oostende, Belgium

PostPosted: Mon Jan 24, 2011 3:34 pm    Post subject: Re: How to create PROC in CLIST?
Reply with quote

AD 2011 you write REXX, not CLIST.

Read about REXX and more specifically about STEMs.
Back to top
View user's profile Send private message
pmvino

New User


Joined: 22 Aug 2008
Posts: 20
Location: india

PostPosted: Mon Jan 24, 2011 4:01 pm    Post subject: Reply to: How to create PROC in CLIST?
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Mon Jan 24, 2011 4:04 pm    Post subject: Re: Reply to: How to create PROC in CLIST?
Reply with quote

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
View user's profile Send private message
Raje1002

New User


Joined: 21 Feb 2009
Posts: 11
Location: India

PostPosted: Mon Jan 24, 2011 4:39 pm    Post subject:
Reply with quote

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
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1060
Location: Oostende, Belgium

PostPosted: Mon Jan 24, 2011 5:03 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Raje1002

New User


Joined: 21 Feb 2009
Posts: 11
Location: India

PostPosted: Thu Jan 27, 2011 11:34 am    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Jan 27, 2011 1:48 pm    Post subject: Reply to: How to create PROC in CLIST?
Reply with quote

Good to hear this is working - Thank you for sharing your solution icon_smile.gif

d
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts LIBDEF not working in called proc packerm CLIST & REXX 0 Fri Sep 15, 2017 7:22 pm
No new posts How do I create a mainframe monitorin... anjali.bisht All Other Mainframe Topics 4 Fri Sep 01, 2017 2:20 pm
This topic is locked: you cannot edit posts or make replies. rexx to create a tso command Bharath Vikraman CLIST & REXX 1 Tue Aug 08, 2017 3:32 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us