I wouldn't characterize CLIST as 'always ignoring the first ampersand'. The
ampersand in
SET &COLOR = RED
is *optional* because the position of the term to the left of the equal
sign marks it as a variable regardless of whether the ampersand is coded.
That is, only a variable could possibly occupy that position. Hence this
statement is equivalent:
SET COLOR = RED
On the right side of the equal sign, the ampersand is always significant
because that position may be occupied by either a constant or a variable.
Only the presence or absence of an ampersand can distinguish the two cases.
The magic of 'variables within variables', the key to a logical array,
comes from an iterative substitution process that repeatedly resolves a
term that still has an ampersand left after the previous resolution.
Iterative substitution is managed by control variable &SYSSCAN. From the
1.7 TSO/E CLIST manual:
5.6.2 &SYSSCAN
&SYSSCAN contains a number that defines the maximum number of times
symbolic substitution is performed on each line in a CLIST. The default
number is 16. You can assign &SYSSCAN a value from 0 to +2,147,483,647
(2³¹-1). A zero limit inhibits all scans, preventing any substitution of
values for symbolic variables. For example, to write a record containing
an ampersand (&), and prevent a CLIST from performing erroneous symbolic
substitution, you can code the following:
.
.
.
SET &SYSSCAN=0 /* Prevent symbolic substitution
WRITE Jack & Jill went up the hill
SET &SYSSCAN=16 /*Reset &SYSSCAN
.
.
JO.Skip Robinson
Southern California Edison Company
SHARE MVS Program Co-Manager
626-302-7535 Office
323-715-0595 Mobile
[EMAIL PROTECTED]
IBM Mainframe Discussion List <[email protected]> wrote on 02/10/2006
09:42:57 AM:
> >From: "Shmuel Metz (Seymour J.)" <[EMAIL PROTECTED]>
> >Where is there a reference to a variable called &COLOR? Shouldn't
> >&&COLOR&COUNT expand to &(name), where name is COLOR followed by the
> >value of &COUNT?
> >
> >Shouldn't that be SET &COLOR1 = 1?
> >
>
> If it worked like REXX, then yes it would work the way you've described.
But
> the way I understand it is that CLIST always ignores the first ampersand
and
> then evaluates the rest of the statement. For example:
>
> SET &COLOR = RED is exactly the same as coding SET COLOR = RED
>
<snip>
----------------------------------------------------------------------
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