Previous Topic: Invoking REXX ProgramsNext Topic: Accessing Various Command Environments Through REXX


REXX Search Order Considerations

When this product launches a REXX script the following search order is used to find the REXX script:

  1. Site REXX files directory, the %AP_SITE%\MyFiles\REXX subdirectory
  2. Product support files directory, the %AP_HOME%\Distrib directory

An example, this product can launch a REXX script from rules.

Distributed REXX scripts use this search order when calling external scripts/routines. This makes it possible for distributed scripts to be overridden using custom versions that are placed in %AP_SITE%\MyFiles\REXX. To achieve this search order, these scripts use the .ap~excall custom method for calling external scripts, instead of the call instruction which uses a slightly different search order. The .ap~excall method is located in the aplib.rex REXX library which is installed in the %AP_HOME%\Distrib directory along with the other distributed REXX scripts.

To take advantage of this method, in your own custom REXX scripts the aplib.rex library needs to be referenced using the ::requires directive at the end of the script. The method can then be used within the script as shown by the following example:

.ap~excall(bind, ‘Session A’ 300)
...
.ap~excall(unbind, ‘Session A’)
...
::requires ‘aplib.rex’

For a detailed description of the .ap~excall method including its operands and return value see the inline help that is included in the %AP_HOME%\Distrib\aplib.rex script.

For more details about the search order that is used by the built-in call instruction see the Open Object REXX documentation, specifically section 7.2.1. Search Order in the Reference manual (rexxref.pdf).