IBM SC34-5764-01 Server User Manual


 
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:
v 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.
1. 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.
v Execs in storage (from an earlier EXECLOAD).
v The current RFS directory.
v 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.
v 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.
v VSE Librarian sublibraries in the order listed in the most recent SETSYS AUTHELIB command.
v VSE Librarian members with a member type of PROC in the LIBDEF PROC search chain for the CICS
partition.
Errors During Execution
If an external or built-in function detects an error of any kind, the language processor is informed, and a
syntax error results. Execution of the clause that included the function call is, therefore, ended. Similarly, if
an external function fails to return data correctly, the language processor detects this and reports it as an
error.
If a syntax error occurs during the execution of an internal function, it can be trapped (using SIGNAL ON
SYNTAX) and recovery may then be possible. If the error is not trapped, the program is ended.
Functions
Chapter 14. Functions 173