Variable Names
A
variable name, the part that represents the value, is always on the
left of the assignment statement and the value itself is on the right.
In the following example, the word "variable1" is the variable name:
variable1 = 5
SAY variable1As a result of the above assignment statement,
variable1 is
assigned the value "5", and you see on the terminal screen: 5
Variable names can consist of:
- A…Z
- uppercase alphabetic
- a…z
- lowercase alphabetic
- 0…9
- numbers
- @ # $ c ? ! . _
- special characters
- X'41' … X'FE'
- double-byte character set (DBCS) characters. (ETMODE must be on for these characters to be valid in a variable name.)
Restrictions on the variable name are:
- The first character cannot be 0 through 9 or a period (.)
- The variable name cannot exceed 250 bytes. For names containing DBCS characters, count each DBCS character as two bytes, and count the shift-out (SO) and shift-in (SI) as one byte each.
- DBCS characters within a DBCS name must be delimited by SO (X'0E')
and SI (X'0F'). Also note that:
- SO and SI cannot be contiguous.
- Nesting of SO / SI is not permitted.
- A DBCS name cannot contain a DBCS blank (X'4040').
- The variable name should not be RC, SIGL, or RESULT, which are REXX special variables. More about special variables appears later in this book.
Examples of acceptable variable names are:
ANSWER ?98B X Word3 number the_ultimate_valueAlso, if ETMODE is set on, the following are valid DBCS variable names, where < represents shift-out, and > represents shift-in, ‘.X’, ‘.Y’, and ‘.Z’ represent DBCS characters, and lowercase letters and numbers represent themselves.
<.X.Y.Z> number_<.X.Y.Z> <.X.Y>1234<.Z>