TAL Programmer's Guide
Using Procedure Options
Using Procedures
096254 Tandem Computers Incorporated 11–11
In the following example, the EXTENSIBLE procedure returns control to the caller if
either required parameter is absent. Also the procedure provides a default 0 to use if
the optional parameter is absent.
PROC errmsg (msg, count, errnum) EXTENSIBLE;
INT .msg; !Required by your code
INT count; !Required by your code
INT errnum; !Optional
BEGIN
IF NOT $PARAM (msg) OR !Check for required parameters
NOT $PARAM (count) THEN
RETURN; !Return to caller if either
! required parameter is absent
IF NOT $PARAM (errnum) THEN !Check for optional parameter
errnum := 0; !Use 0 if optional parameter
! is absent
!Process the error
END;
Passing Parameters to
VARIABLE or EXTENSIBLE
Procedures
When you call a VARIABLE or EXTENSIBLE procedure, you can omit parameters
indicated as being optional in the called procedure. You can pass or omit such
parameters unconditionally or conditionally.
Passing Parameters Unconditionally
To pass parameters or parameter pairs unconditionally, specify the parameter name in
the CALL statement parameter list. To omit parameters or parameter pairs
unconditionally, use a place-holding comma for each omitted parameter or parameter
pair up to the last specified parameter.
Comments within a CALL statement can help you keep track of which actual
parameters you are omitting. Here is an example:
PROC some_proc (index, error_num, length, limit, total)
EXTENSIBLE;
INT index, error_num, length, limit, .total;
BEGIN
!Lots of code
END;
PROC caller_proc;
BEGIN
INT total;
!Some code
CALL some_proc (0, !error_num!, !length!, 40, total);
!Comments within CALL statement
! identify omitted parameters
!More code
END;