Initialization and termination of a language processor environment

Before the language processor environment can process a REXX exec, a language processor environment must exist. A language processor environment is the environment in which the language processor interprets or processes the exec. This environment defines characteristics relating to how the exec is processed and how the language processor accesses system services.

A language processor environment defines various characteristics, such as:
  • The search order used to locate commands and external functions and subroutines
  • The ddnames for reading and writing data and from which REXX execs are loaded
  • The host command environments you can use in an exec to execute host commands (that is, the environments you can specify using the ADDRESS instruction)
  • The function packages (user, local, and system) that are available to execs that execute in the environment and the entries in each package
  • Whether execs that execute in the environment can use the data stack or can perform I/O operations
  • The names of routines that handle system services, such as I/O operations, loading of an exec, obtaining and freeing storage, and data stack requests. These routines are known as replaceable routines.

The concept of a language processor environment is different from that of a host command environment. The language processor environment is the environment in which a REXX exec executes. This includes how an exec is loaded, how commands, functions, and subroutines are located, and how requests for system services are handled. A host command environment is the environment to which the language processor passes commands for execution. The host command environment handles the execution of host commands. The host command environments that are available to a REXX exec are one characteristic of a language processor environment. For more information about executing host commands from a REXX exec, see Commands to external environments.

TSO/E automatically initializes a language processor environment in both the TSO/E and non-TSO/E address spaces by calling the initialization routine IRXINIT. TSO/E terminates a language processor environment by calling the termination routine IRXTERM.

In the TSO/E address space, IRXINIT is called to initialize a default language processor environment when a user logs on and starts a TSO/E session. When a user invokes ISPF, another language processor environment is initialized. The ISPF environment is a separate environment from the one that is initialized when the TSO/E session is started. Similarly, if you enter split screen mode in ISPF, another language processor environment is initialized for the second ISPF screen. Therefore, three separate language processor environments exist. If the user invokes a REXX exec from the second ISPF screen, the exec executes within the language processor environment that was initialized for that second screen. If the user invokes the exec from TSO/E READY mode, it executes within the environment that was initialized when the user first logged on.

When the user returns to a single ISPF screen, the IRXTERM routine is called to automatically terminate the language processor environment that is associated with the second ISPF screen. Similarly, when the user exits from ISPF and returns to TSO/E READY mode, the system calls IRXTERM to terminate the environment associated with the ISPF screen. When the user logs off from TSO/E, that language processor environment is then terminated.

In non-TSO/E address spaces, a language processor environment is not automatically initialized at a specific point, such as when the address space is activated. An environment is initialized when either the IRXEXEC or IRXJCL routines are called to execute a REXX exec, if an environment does not already exist.

As described above, many language processor environments can exist in an address space. A language processor environment is associated with an MVS™ task and environments can be chained together. This is discussed in more detail in Language processor environments.

Whenever a REXX exec is invoked in any address space, the system first determines whether a language processor environment exists. If an environment does exist, the REXX exec executes in that environment. If an environment does not exist, the system automatically initializes one by calling the IRXINIT routine. For example, if you are logged on to TSO/E and issue the TSO/E EXEC command to execute a REXX exec, the system checks whether a language processor environment exists. An environment was initialized when you logged on to TSO/E, therefore, the exec executes in that environment. If you execute a REXX exec in MVS batch by specifying IRXJCL as the program name (PGM= ) on the JCL EXEC statement, a language processor environment is initialized for the execution of the exec. When the exec completes processing, the environment is terminated.

If either IRXJCL or IRXEXEC is called from a program, the system first determines whether a language processor environment already exists. If an environment exists, the exec executes in that environment. If an environment does not exist, an environment is initialized. When the exec completes, the environment is terminated. Chains of environments and how environments are located describes how the system locates a previous environment in the TSO/E and non-TSO/E address spaces.

TSO/E provides default values that are used to define a language processor environment. The defaults are provided in three parameters modules that are load modules. The load modules contain the default characteristics for initializing language processor environments for TSO/E (READY mode), ISPF, and non-TSO/E address spaces. The parameters modules are:
  • IRXTSPRM (for TSO/E)
  • IRXISPRM (for ISPF)
  • IRXPARMS (for non-TSO/E)

You can provide your own parameters modules to change the default values that are used to initialize a language processor environment. Your load modules are then used instead of the default modules provided by TSO/E. The parameters modules are described in detail in Language processor environments.

You can also explicitly invoke IRXINIT to initialize a language processor environment and define the environment characteristics on the call. Although IRXINIT is primarily intended for use in non-TSO/E address spaces, you can call it in any address space. When you call IRXINIT, you specify any or all of the characteristics you want defined for the language processor environment. Using IRXINIT gives you the flexibility to define your own environment, and therefore, customize how REXX execs execute within the environment and how system services are handled. If you explicitly call IRXINIT, you must use the IRXTERM routine to terminate that environment. The system does not automatically terminate an environment that you initialized by explicitly calling IRXINIT. Initialization and termination routines describes the IRXINIT and IRXTERM routines.