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.
External functions and subroutines have a system-defined search order.
The search order for external functions and subroutines follows.
Whenever an exec, command, external function, or subroutine, written
in REXX is invoked by REXX/CICS (for example: from the CICS command
line, CALL instruction, EXEC command, or a command from within an
exec), the search order for locating the target exec is as follows:
- Search order for a DEFCMD defined command exec or other called
exec:
Note: If this is an attempt to execute an authorized
command, a check is made to see if this is an authorized user or the
command is in an exec loaded from a VSE Librarian sublibrary specified
on a SETSYS AUTHCLIB or SETSYS AUTHELIB command. If none of these
are true, the command fails with a return code of -4.
- Within the current exec for an internal function or subroutine.
Note: This search can be bypassed
by explicitly identifying the function (or subroutine) as external
by enclosing its name in quotes.
- Execs in storage (from an earlier EXECLOAD).
- The current RFS directory.
- The current PATH. RFS directories and VSE Librarian sublibraries
are searched in the order listed in the most recent PATH command,
if it was executed.
- VSE Librarian sublibraries in the order listed in the most recent
SETSYS AUTHCLIB command.
If the user is an authorized user or if
the current exec was loaded from a sublibrary specified on the last
SETSYS AUTHELIB command and the search is for an authorized command's
program, then check the sublibraries specified on the most recent
SETSYS AUTHCLIB command.
- VSE Librarian sublibraries in the order listed in the most recent
SETSYS AUTHELIB command.
- VSE Librarian members with a member type of PROC in the LIBDEF
PROC search chain for the CICS partition.