where d0 is the uppercase form of the symbol s0, and v1 to vn are the values of the constant or simple
symbols s1 through sn. Any of the symbols s1-sn can be null. The values v1-vn can also be null and can
contain any characters (in particular, lowercase characters are not translated to uppercase, blanks are not
removed, and periods have no special significance).
Some examples follow in the form of a small extract from a REXX program:
a=3 /* assigns '3' to the variable A */
z=4 /* '4' to Z */
c='Fred' /* 'Fred' to C */
a.z='Fred' /* 'Fred' to A.4 */
a.fred=5 /* '5' to A.FRED */
a.c='Bill' /* 'Bill' to A.Fred */
c.c=a.fred /* '5' to C.Fred */
y.a.z='Annie' /* 'Annie' to Y.3.4 */
sayazca.aa.za.cc.aa.fred y.a.4
/* displays the string: */
/* "3 4 Fred A.3 Fred Bill C.3 5 Annie" */
You can use compound symbols to set up arrays and lists of variables in which the subscript is not
necessarily numeric, thus offering great scope for the creative programmer. A useful application is to set
up an array in which the subscripts are taken from the value of one or more variables, effecting a form of
associative memory (content addressable).
Implementation maximum: The length of a variable name, before and after substitution, cannot exceed
250 characters.
Stems
A stem is a symbol that contains just one period, which is the last character. It cannot start with a digit or
a period.
These are stems:
FRED.
A.
<.A.B>.
By default, the value of a stem is the string consisting of the characters of its symbol (that is, translated to
uppercase). If the symbol has been assigned a value, it names a variable and its value is the value of that
variable.
Further, when a stem is used as the target of an assignment, all possible compound variables whose
names begin with that stem receive the new value, whether they previously had a value or not. Following
the assignment, a reference to any compound symbol with that stem returns the new value until another
value is assigned to the stem or to the individual variable.
For example:
hole. = "empty"
hole.9 = "full"
say hole.1 hole.mouse hole.9
/* says "empty empty full" */
Thus, you can give a whole collection of variables the same value. For example:
total. = 0
do forever
say "Enter an amount and a name:"
REXX General Concepts
Chapter 12. REXX General Concepts 123