Hi Nick,
If you already know REXX my advise would be stay away from CLIST as REXX is
much more powerful. If there's some reason why you can't do that and you
absolutely have to use CLIST, you can create an array by prefixing variables
with adjoining ampersands. For example:
/* This CLIST demonstrates how to create an array. */
/**********************************************************************/
SET &COLOR1 = RED
SET &COLOR2 = BLUE
SET &COLOR3 = GREEN
SET &COUNT = 1
DO WHILE &COUNT < 4
SET &TEMP = &&COLOR&COUNT
WRITE &TEMP
SET &COUNT = &COUNT + 1
END
The above loop executes 3 times, and each time through it displays a color
(i.e. RED, BLUE, or GREEN). This is how it works:
When CLIST encounters 2 or more ampersands, it simply drops the first
ampersand. Therefore, &&COLOR becomes &COLOR. The variable &COUNT only has a
single ampersand, so the first time through the loop the value of &COUNT is
resolved and becomes 1. The overall net effect is that &TEMP is set to
&COLOR1; i.e. &TEMP is set to a variable NAME (and not the actual contents
of the variable). When the WRITE occurs, the value of the variable &COLOR1
is resolved, and so the word RED is written. Rinse and repeat, and the next
colors are displayed.
As I said, REXX is a lot easier. :-)
Hope this helps,
Dave Salt
SimpList(tm) - The easiest, most powerful way to surf a mainframe!
http://www.mackinney.com/products/SIM/simplist.htm
From: "Pullman, Nick" <[EMAIL PROTECTED]>
Reply-To: IBM Mainframe Discussion List <[email protected]>
To: [email protected]
Subject: CLIST array variable?
Date: Wed, 8 Feb 2006 18:20:47 -0500
All,
I am completely new to CLIST so please forgive me for my ignorance. Is
there any type of array variable type in CLIST or anything like a stem
variable in REXX? I am somewhat familiar with Rexx, and I am used to using
stem variables and dereferencing the values in a loop, but I can't seem to
find an equivalent data type in CLIST. I have looked in the IBM Library
Server books under TSO/E CLISTS, but I am not finding anything that
resembles an array type of variable. Any help is very much appreciated.
Regards,
Nick Pullman
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html