1 environment?expression
1 ?VALUEexpression1
2 ;

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.

How to enter commands to the host and the different host command environments TSO/E provides are described in Commands to external environments.

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 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 Commands.) Errors and failures in commands processed in this way are trapped or traced as usual.

ADDRESS LINK "routine p1 p2"       /*   TSO/E   */

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.

Address MVS

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).

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.

The two environment names are automatically saved across internal and external subroutine and function calls. See CALL) for more details.

The address setting is the currently selected environment name. You can retrieve the current address setting by using the ADDRESS built-in function (see ADDRESS).

TSO/E REXX provides several host command environments that you can use with the ADDRESS instruction. The environments allow you to use different TSO/E, MVS™, and ISPF services. See Host commands and host command environments.

You can provide your own environments or routines that handle command processing in each environment. For more information, see Host command environment table.