typedef struct { struct { unsigned rxfferr : 1; /* Invalid call to routine. */ unsigned rxffnfnd : 1; /* Function not found. */ unsigned rxffsub : 1; /* Called as a subroutine if */ /* TRUE. Return values are */ /* optional for subroutines, */ /* required for functions. */ } rxfnc_flags ; PUCHAR rxfnc_name; /* Pointer to function name. */ USHORT rxfnc_namel; /* Length of function name. */ PUCHAR rxfnc_que; /* Current queue name. */ USHORT rxfnc_quel; /* Length of queue name. */ USHORT rxfnc_argc; /* Number of args in list. */ PRXSTRING rxfnc_argv; /* Pointer to argument list. */ /* List mimics argv list for */ /* function calls, an array of */ /* RXSTRINGs. */ RXSTRING rxfnc_retc; /* Return value. */ } RXFNCCAL_PARM;
The name of the external function is defined by rxfnc_name and rxfnc_namel. The arguments to the function are in rxfnc_argc and rxfnc_argv. If you call the named external function with the REXX CALL instruction (rather than using a function call), the flag rxffsub is TRUE.
The exit handler can set rxfnc_flags to indicate whether the external function call was successful. If neither rxfferr or rxffnfnd is TRUE, the exit handler successfully called the external function. The error flags are checked only when the exit handler handles the request.
The exit handler sets rxffnfnd to TRUE when the exit handler cannot locate the external function. The interpreter raises REXX error 43, "Routine not found". The exit handler sets rxfferr to TRUE when the exit handler locates the external function, but the external function returned an error return code. The REXX interpreter raises error 40, "Incorrect call to routine."
The exit handler returns the external function result in the rxfnc_retc RXSTRING. The REXX interpreter raises error 44, "Function or method did not return data," when the external routine is called as a function and the exit handler does not return a result. When the external routine is called with the REXX CALL instruction, a result is not required.