ADDRESS
Purpose
ADDRESS
environment
expression
expression1
VALUE
;
ADDRESS temporarily or permanently changes the destination of commands. Commands are strings sent
to an external environment. You can send commands by specifying clauses consisting of only an
expression or by using the ADDRESS instruction.
The concept of alternative subcommand environments is described in section “Issuing Commands from a
program” on page 82.
To send a single command to a specified environment, code an environment, a literal string or a single
symbol, which is taken to be a constant, followed by an expression. (The environment name is the name
of an external procedure or process that can process commands.) The environment name is limited to
eight characters. The expression is evaluated, and the resulting string is routed to the environment to be
processed as a command. (Enclose in quotation marks any part of the expression you do not want to be
evaluated.) After execution of the command, environment is set back to whatever it was before, thus
temporarily changing the destination for a single command. The special variable RC is set, just as it would
be for other commands. (See page 125.) Errors and failures in commands processed in this way are
trapped or traced as usual.
Example:
ADDRESS CICS "READQ TSQ QUEUE('QUEUE1') INTO(VAR1)" /* CICS */
If you specify only environment, a lasting change of destination occurs: all commands that follow (clauses
that are neither REXX instructions nor assignment instructions) are routed to the specified command
environment, until the next ADDRESS instruction is processed. The previously selected environment is
saved.
Example:
address cics
"READQ TSQ QUEUE('QUEUE1') INTO(VAR1)"
ADDRESS RFS
'COPY PROFILE.EXEC TEMP.EXEC'
Similarly, you can use the VALUE form to make a lasting change to the environment. Here expression1
(which may be simply a variable name) is evaluated, and the result forms the name of the environment.
You can omit the subkeyword VALUE if expression1 does not begin with a literal string or symbol (that is,
if it starts with a special character, such as an operator character or parenthesis).
Example:
ADDRESS ('ENVIR'||number) /* Same as ADDRESS VALUE 'ENVIR'||number */
With no arguments, commands are routed back to the environment that was selected before the previous
lasting change of environment was made, and the current environment name is saved. After changing the
environment, repeated execution of ADDRESS alone, therefore, switches the command destination
between two environments alternately.
ADDRESS
132
CICS TS for VSE/ESA: REXX Guide