Product SiteDocumentation Site

1.15. Commands to External Environments

Issuing commands to the surrounding environment is an integral part of Rexx.

1.15.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. Normally the default environment is the used shell, mostly "CMD" on Windows systems and "bash" on Linux systems. 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: Programming Guide for a discussion of this mechanism.