SUBCOM
queries the existence of a specified host command environment. SUBCOM searches the host command environment table for the named environment and sets the REXX special variable RC to 0 or 1. When RC contains 0, the environment exists. When RC contains 1, the environment does not exist.
You can use the SUBCOM command in REXX execs that run in any address space, TSO/E or non-TSO/E. That is, SUBCOM is available from the TSO and MVS host command environments.
Before an exec runs, a default host command environment is defined to process the commands that the exec issues. You can use the ADDRESS keyword instruction (see ADDRESS) to change the environment to another environment as long as the environment is defined in the host command environment table. Use the SUBCOM command to determine whether the environment is defined in the host command environment table for the current language processor environment. You can use the ADDRESS built-in function to determine the name of the environment to which host commands are currently being submitted (see ADDRESS).
Operand: The one operand for the SUBCOM command is:
- envname
- the name of the host command environment for which SUBCOM is to search.
- TSO (the default environment)
- CONSOLE
- CPICOMM
- LU62
- MVS
- LINK
- ATTACH
- LINKPGM
- ATTCHPGM
- LINKMVS
- ATTCHMVS
- SYSCALL
- BCPII
- MVS (the default environment)
- CPICOMM
- LU62
- LINK
- ATTACH
- LINKPGM
- ATTCHPGM
- LINKMVS
- ATTCHMVS
- SYSCALL
- TSO (the default environment)
- CONSOLE
- ISPEXEC
- ISREDIT
- CPICOMM
- LU62
- MVS
- LINK
- ATTACH
- LINKPGM
- ATTCHPGM
- LINKMVS
- ATTCHMVS
- SYSCALL
- BCPII
The SUBCOM command sets the REXX special variable RC to indicate the existence of the specified environment.
| RC value | Description |
|---|---|
| 0 | The host command environment exists. |
| 1 | The host command environment does not exist. |
Example
"SUBCOM ispexec"
IF RC = 0 THEN
ADDRESS ispexec
ELSE NOP