To send a command to a specific environment, use this format of the ADDRESS instruction:
ADDRESS environment expression
For environment, specify the destination of the command. To address the OS/2 environment, use the symbol CMD. For expression, specify an expression that results in a string that REXX passes to the environment. Here are some examples:
address CMD "dir" /* pass the literal string */
/* "dir" to OS/2 program */
cmdstr = 'dir *.txt' /* assign a string */
/* to a variable */
address CMD cmdstr /* REXX passes the string */
/* "dir *.txt" to OS/2 */
address edit "regen" /* REXX passes the "regen" */
/* command to a fictitious */
/* environment named edit */
Notice that the ADDRESS instruction lets a single REXX program issue commands to two or more environments.