Determining The Active Host Command Environment; Checking If A Host Command Environment Is Available; Examples Using The Address Instruction - IBM TSO/E REXX User Manual

Table of Contents

Advertisement

When an ADDRESS instruction includes only the name of the host command
environment, all commands issued afterward within that exec are processed as
that environment's commands.
ADDRESS ispexec
/* Change the host command environment to ISPF */
"edit DATASET("dsname")"
The ADDRESS instruction affects only the host command environment of the
exec that uses the instruction. When an exec calls an external routine, the host
command environment reverts back to the default environment, regardless of the
host command environment of the exec that called it. Upon return to the original
exec, the host command environment that was previously established by an
ADDRESS instruction is resumed.
v Single command
When an ADDRESS instruction includes both the name of the host command
environment and a command, only that command is affected. After the command
is issued, the former host command environment becomes active again.
/* Issue one command from the ISPF host command environment
ADDRESS ispexec "edit DATASET("dsname")"
/* Return to the default TSO host command environment
"ALLOC DA("dsname") F(SYSEXEC) SHR REUSE"
Note: Keywords, such as DATASET, within an ISPF command must be in
uppercase when used in a REXX instruction.

Determining the Active Host Command Environment

To find out what host command environment is currently active, use the ADDRESS
built-in function.
x = ADDRESS()
In this example, x is set to the active host command environment, for example,
TSO.

Checking if a Host Command Environment is Available

To check if a host command environment is available before trying to issue
commands to that environment, issue the TSO/E REXX SUBCOM command
followed by the name of the host command environment, such as ISPEXEC.
SUBCOM ISPEXEC
If the environment is present, the REXX special variable RC returns a 0. If the
environment is not present, RC returns a 1. For example, when editing a data set,
before trying to use ISPF/PDF edit, you can find out if ISPEXEC is available as
follows:
ARG dsname
SUBCOM ISPEXEC
IF RC=0 THEN
ADDRESS ISPEXEC "SELECT PGM(ISREDIT)"
ELSE
"EDIT" dsname

Examples Using the ADDRESS Instruction

Issuing Other Types of Commands from an Exec
/* select ISPF/PDF edit */
/* use TSO/E line mode edit */
Chapter 8. Entering Commands from an Exec
*/
*/
107

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents