The search order for functions is: internal routines take precedence, then
built-in functions, and finally external functions.
Internal routines are not used if the
function name is given as a literal string (that is, specified in
quotation marks); in this case the function must be built-in or external.
This lets you usurp the name of, say, a built-in function to extend
its capabilities, yet still be able to call the built-in function
when needed.
Example: /* This internal DATE function modifies the */
/* default for the DATE function to standard date. */
date: procedure
arg in
if in='' then in='Standard'
return 'DATE'(in)
Built-in functions have uppercase names, and
so the name in the literal string must be in uppercase for the search
to succeed, as in the example. The same is usually true of external
functions. The search order for external functions and subroutines follows.
- Check the following function packages defined for the language
processor environment:
- User function packages
- Local function packages
- System function packages
- If a match to the function name is not found, the function search
order flag (FUNCSOFL) is checked. The FUNCSOFL flag (see Flags and corresponding masks) indicates whether load libraries are
searched before the search for a REXX exec.
If the flag is off,
check the load libraries. If a match to the function name is not found,
search for a REXX program.
If the flag is on, search for a
REXX program. If a match to the function name is not found, check
the load libraries.
By default, the FUNCSOFL flag is off, which
means that load libraries are searched before the search for a REXX
exec.
You can use TSO/E EXECUTIL RENAME to change functions
in a function package directory. For more information, see EXECUTIL RENAME.
- TSO/E uses the following order to search the load libraries:
- Job pack area
- ISPLLIB. If the user entered LIBDEF ISPLLIB ..., the system
searches the new alternate library defined by LIBDEF followed by the
ISPLLIB library.
- Task library and all preceding task libraries
- Step library. If there is no step library, the job library is
searched, if one exists.
- Link pack area (LPA)
- Link library
- The following list describes the steps used to search for a REXX
exec for a function or subroutine call:
Restriction: VLF
is not searched for REXX execs called as functions or subroutines.
- Search the ddname from which the exec that is calling the function
or subroutine was loaded. For example, if the calling exec was loaded
from the DD MYAPPL, the system searches MYAPPL for the function or
subroutine.
Note: If the calling exec is running in a non-TSO/E address
space and the exec (function or subroutine) being searched for was
not found, the search for an exec ends. Note that depending on the
setting of the FUNCSOFL flag, the load libraries may or may not have
already been searched at this point.
- Search any exec libraries as defined by the TSO/E ALTLIB command
- Check the setting of the NOLOADDD flag (see Flags and corresponding masks).
- If the NOLOADDD flag is off, search any data sets that are allocated
to SYSEXEC. (SYSEXEC is the default system file in which you can
store REXX execs; it is the default ddname specified in the LOADDD
field in the module name table. See Module name table).
If the function or subroutine is not found, search the data sets
allocated to SYSPROC. If the function or subroutine is not found,
the search for an exec ends. Note that depending on the setting of
the FUNCSOFL flag, the load libraries may or may not have already
been searched at this point.
- If the NOLOADDD flag is on, search any data sets that are allocated
to SYSPROC. If the function or subroutine is not found, the search
for an exec ends. Note that depending on the setting of the FUNCSOFL
flag, the load libraries may or may not have already been searched
at this point.
Note: With the defaults that TSO/E provides, the NOLOADDD flag
is off. This means that SYSEXEC is searched before SYSPROC.
You
can control the NOLOADDD flag using the TSO/E REXX EXECUTIL command.
For more information, see EXECUTIL.
Figure 1 illustrates how a call to
an external function or subroutine is handled. After the user, local,
and system function packages, and optionally, the load libraries are
searched, if the function or subroutine was not found, the system
searches for a REXX exec. The search for an exec is shown in part
2 of the figure.
Figure 1. External
routine resolution and execution Part 1
Figure 2. External routine resolution and execution Part
2