z/OS TSO/E REXX Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Locating a Language Processor Environment

z/OS TSO/E REXX Reference
SA32-0972-00

A REXX environment is considered integrated into TSO/E if the address space is a TSO/E address space and the environment has the TSOFL flag set on. Otherwise the environment is not integrated into TSO/E (TSOFL flag off). For the following discussion, a REXX environment that is integrated into TSO/E will be referred to as a "TSO/E environment"; and a REXX environment that is not integrated into TSO/E will be referred to as a "non-TSO/E environment." For more information, see Types of environments - integrated and not integrated into TSO/E.

Whenever you invoke a REXX exec or routine, the exec or routine must run in a language processor environment. The one exception is the initialization routine, IRXINIT, which initializes environments.

In the TSO/E address space, the system always initializes a default language processor environment when you log on TSO/E and when you invoke ISPF. If you call a REXX programming routine from TSO/E, the routine runs in the environment in which you called it.

If you invoke an exec using the IRXJCL or IRXEXEC routine, a language processor environment may or may not already exist. If an environment does not exist on the
  • Current task (non-TSO/E environment), or
  • Current task or a parent task (TSO/E environment)
the system calls the IRXINIT routine to initialize an environment before the exec runs. Otherwise, the system locates the current non-reentrant environment and the exec runs in that environment.

IRXINIT always locates a previous language processor environment. If an environment does not exist on the current task (TSO/E or non-TSO/E environment) or on a parent task (TSO/E environment only), IRXINIT uses the values in the IRXPARMS parameters module as the previous environment.

A language processor environment must already exist if you call the TSO/E REXX programming routines IRXRLT, IRXSUBCM, IRXIC, IRXEXCOM, and IKJCT441 or the replaceable routines. These routines do not invoke IRXINIT to initialize a new environment. If an environment does not already exist and you call one of these routines, the routine completes unsuccessfully with a return code. See TSO/E REXX programming services for information about the TSO/E REXX programming routines and Replaceable routines and exits for information about the replaceable routines.

When IRXINIT initializes a new language processor environment, IRXINIT creates a number of control blocks that contain information about the environment and any REXX exec currently running in the environment. The main control block is the environment block (ENVBLOCK), which points to other control blocks, such as the parameter block (PARMBLOCK) and the work block extension. Control blocks created for a Language Processor Environment describes the control blocks that IRXINIT creates for each language processor environment.

The environment block represents its language processor environment and is the anchor that the system uses on calls to all REXX programming service routines. Whenever you call a REXX programming service routine, you can pass the address of an environment block in register 0 on the call. By passing the address, you can specify in which language processor environment you want the routine to run. For example, suppose you invoke the initialization routine, IRXINIT, in a non-TSO/E address space. On return, IRXINIT returns the address of the environment block for the new environment in register 0. You can store that address for future use. Suppose you call IRXINIT several times to initialize a total of four environments in that address space. If you then want to call a TSO/E REXX programming service routine and have the routine run in the first environment on the chain, you can pass the address of the first environment's environment block on the call.

You can also pass the address of the environment block in register 0 to all REXX replaceable routines and exit routines. Some service routines also allow the address of the environment block to be passed as a parameter, in place of using register 0. If the parameter is used in these cases, register 0 is ignored.

When a programming service routine is called, the programming service routine must determine in which environment to run. The routine locates the environment as follows:

  1. The routine checks for an environment block parameter (where allowed) or register 0 to determine whether the address of an environment block was passed on the call. If an address was passed, the routine determines whether the address points to a valid environment block. The environment block is valid if:
    • The environment is either a reentrant or non-reentrant environment on the current task (non-TSO/E environment)
    • The environment is either a reentrant or non-reentrant environment on the current task or on a parent task (TSO/E environment).
  2. If the address of a valid environment block was not passed, the routine that is called:
    • Searches for a non-reentrant environment on the current task (non-TSO/E environment). If a non-reentrant environment is found, the routine runs in that environment.
    • Searches for a non-reentrant environment on the current task (TSO/E environment). If a non-reentrant environment is found on the current task, the routine runs in that environment. If a non-reentrant environment is not found on the current task, the parent tasks are searched for a non-reentrant environment. If a non-reentrant TSO/E environment is found on any of these ancestor tasks, the routine runs in that environment.
  3. If the routine could not find a valid environment using the previous steps, the next step depends on what routine was called.
    • If one of the REXX programming routines or the replaceable routines was called, a language processor environment is required in order for the routine to run. The routine ends in error. The same occurs for the termination routine, IRXTERM.
    • If IRXEXEC or IRXJCL were called, the routine invokes IRXINIT to initialize a new environment.
    • If IRXINIT was called, IRXINIT uses the IRXPARMS parameters module as the previous environment.

The IRXINIT routine initializes a new language processor environment. Therefore, IRXINIT does not need to locate an environment in which to run. However, IRXINIT does locate a previous environment to determine what values to use when defining the new environment. The following summarizes the steps IRXINIT takes to locate the previous environment:

  1. If register 0 contains the address of a valid environment block, IRXINIT uses that environment as the previous environment.
  2. If IRXINIT has not yet found an environment to use and a non-reentrant environment exists on the current task, IRXINIT uses the last non-reentrant environment on the task as the previous environment.
  3. If IRXINIT has not yet found an environment to use and this is a request for a TSO/E environment, IRXINIT locates the last non-reentrant environment on the parent tasks. If a non-reentrant TSO/E environment is located on any of the parent tasks, IRXINIT uses it as the previous environment.
  4. If IRXINIT cannot find an environment, IRXINIT uses the values in the default parameters module IRXPARMS as the previous environment.

Initialization routine - IRXINIT describes how the IRXINIT routine determines what values to use when you explicitly call IRXINIT.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014