SUBCOM

Read syntax diagramSkip visual syntax diagramSUBCOM  envname

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.
When you invoke an exec from TSO/E, the following default host command environments are available:
  • TSO (the default environment)
  • CONSOLE
  • CPICOMM
  • LU62
  • MVS
  • LINK
  • ATTACH
  • LINKPGM
  • ATTCHPGM
  • LINKMVS
  • ATTCHMVS
  • SYSCALL
  • BCPII
Note: To be correct at the current V2R5 product level, the SYSCALL and BCPII host command environments are added to the set of environments defined when running under TSO and also when running under ISPF.
When you run an exec in a non-TSO/E address space, the following default host command environments are generally available:
  • MVS (the default environment)
  • CPICOMM
  • LU62
  • LINK
  • ATTACH
  • LINKPGM
  • ATTCHPGM
  • LINKMVS
  • ATTCHMVS
  • SYSCALL
Note: Some products can use their own REXX parameter module to create a REXX environment used specifically by that product. For example, under NETVIEW REXX or USS REXX, the product can define a different set of available host command environments, a different initial default host command environment, or both. For USS REXX running under an OMVS environment, the SH host environment is added and SH is defined as the default host command environment, instead of MVS.
When you invoke an exec from ISPF, the following default host command environments are available:
  • 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

To check whether the ISPEXEC environment is available before using the ADDRESS instruction to change the environment, use the SUBCOM command as follows:
"SUBCOM ispexec"
IF RC = 0 THEN
  ADDRESS ispexec
ELSE NOP