Commands

From a REXX program you can pass commands to OS/2 or to applications designed to work with REXX. When used to run OS/2 commands, REXX becomes a powerful substitute for the OS/2 Batch Facility. You can use variables, control structures, math, and parsing to create procedures that would be impossible to implement with the OS/2 Batch Facility.

Applications that are designed to work with REXX are often referred to as scriptable applications. To work with REXX, a scriptable application registers an environment with REXX. An environment serves as a kind of workspace shared between REXX and the application. Environments accept application subcommands issued from REXX programs.

For example, many editors provide a command prompt or dialog box from which you can issue subcommands to set margins, add lines, and so on. If the editor is scriptable from REXX, you can issue editor subcommands from a REXX program. These REXX programs are typically referred to as macros. The Enhanced Editor included with OS/2 is an example of an editor that you can script with REXX macros.

When an application runs a REXX macro, REXX directs commands to the application's environment. If you issue a subcommand that the application does not recognize, it may or may not pass the command to OS/2, depending on the application.

To let you specify which environment processes a command, REXX includes an ADDRESS instruction. Starting your REXX programs from the OS/2 command line makes OS/2 the default environment for REXX commands.


[Back: How the "Play and Display" File Works]
[Next: How to Issue Commands]