REXX compound variable initialization EXECs
Two sample EXECs, MSU006X and MSU006X2, are distributed to show initialization of REXX compound variables.
In CLISTs, compound variables are defined with ampersands (&) and the REXX equivalent of ampersands is the STEM variable. The REXX compound variables are defined with STEM where the STEM variable is of the form VAR.n and n is an integer.
The following instructions reference values for SYS1 and SYS2 within a CLIST:
SET &N = 1 /* INITIALIZE THE INDEX VALUE */
DO WHILE &N LE &SYSN /* SET UP THE LOOP */
IMFEXEC VGET (SYS&N) PROFILE
SET &SS = &&SYS&N /* DERIVE THE VALUE */
The following set of instructions refer to the same values in a REXX EXEC:
IMFEXEC VGET (SYSN) PROFILE
DO N=1 TO SYSN BY 1 UNTIL N>SYSN
IMFEXEC VGET ('SYS'N) PROFILE
SS = VALUE('SYS'N) /* DERIVE THE VALUE */
Notice that with CLISTs, the value of a compound variable must be derived using the && expression, whereas REXX uses the built-in function VALUE.
The apostrophes around SYS define it as a literal to REXX and distinguish the literal from the variable N. If a STEM variable was defined at initialization, this example could have used the following instruction to get the values for SYS.N :
With this instruction, there are no apostrophes to distinguish SYS as a literal because ' SYS. ' is a STEM and REXX defaults it to a literal.
Note that there is no SET command in REXX EXECs. Any expression with an equal sign (=) implies an ASSIGNMENT command that functions the same as a CLIST SET command. MSU006X initializes the SYSN variables for reference by both CLIST and REXX EXECs. MSU006X is a REXX EXEC because the STEM variable, SYS.1, is not a valid expression within a CLIST.
MSU006X illustrates the assignment of values to both SYS1 and SYS.1 variables but you must code the values within the EXEC. MSU006X2 illustrates the assignment of values to the STEM variables SYS.n by deriving the values of SYS&n within the context of BMC AMI Ops Automation initialization.
REXX EXEC - MSU006X
SYS1='NONE' /* TARGET SYSTEM(NAME#1) FOR CLIST REFS */
SYS2='NONE' /* TARGET SYSTEM(NAME#2) FOR CLIST REFS */
SYS.1='NONE' /* TARGET SYSTEM(NAME#1) FOR REXX REFS */
SYS.2='NONE' /* TARGET SYSTEM(NAME#2) FOR REXX REFS */
/*--------------------------------------------------------------*/
At BMC AMI OpsA initialization, the values for SYS&n were specified to match the number of target systems within your environment. To build the REXX STEM variables, you can either change the whole start up EXEC, MSU002C or use MSU006X2, which dynamically assigns the values.
EXECs for REXX compound variable initialization
EXEC name | Description |
---|---|
MSU006X | assigns values for SYS1, SYS2, SYS.1 and SYS.2 statically |
MSU006X2 | assigns values for SYS.1 and SYS.2 dynamically by deriving the values for SYS1 and SYS2 |
Related topic