Product Site

1.16.1. Environment

The base system for the language processor is assumed to include at least one environment for processing commands. An environment is selected by default on entry to a Rexx program. You can change the environment by using the ADDRESS instruction. You can find out the name of the current environment by using the ADDRESS built-in function. The underlying operating system defines environments external to the Rexx program. The environments selected depend on the caller. The default environment is CMD on Windows and sh on Unix-like systems . There are three aliases for the default environment, "" (null string), COMMAND and SYSTEM. These environments execute commands through the standard command interpreter or system shell, which is cmd.exe on Windows and sh on Unix-like systems . On Unix-like systems alternate environments bsh, bash, csh, ksh, tcsh, and zsh are available, which allow execution of commands through a shell named like the environment, if such a shell is installed on the system.

An additional environment PATH—available on both Windows and Unix-like systems—provides an alternative to command interpreter- / shell-based environments. It executes commands directly, without the need for a command interpreter or shell by searching the environment variable PATH to locate the command. Note that this environment does not provide shell or command interpreter features such as internal commands, redirection, piping, environment variable substitution or wildcard expansion.

If called from an editor that accepts subcommands from the language processor, the default environment can be that editor.

A Rexx program can issue commands—called subcommands—to other application programs. For example, a Rexx program written for a text editor can inspect a file being edited, issue subcommands to make changes, test return codes to check that the subcommands have been processed as expected, and display messages to the user when appropriate.

An application that uses Rexx as a macro language must register its environment with the Rexx language processor. See the Open Object Rexx: Application Programming Interfaces for a discussion of this mechanism.