TAL Programmer's Guide

Using Procedure Options
Using Procedures
11–10 096254 Tandem Computers Incorporated
For example, the following VARIABLE 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) VARIABLE;
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;
Declaring EXTENSIBLE
Procedures
An EXTENSIBLE procedure lets you add new formal parameters to it without
recompiling callers unless the callers use the new parameters. The compiler treats all
parameters of an EXTENSIBLE procedure as if they were optional, even if some are
required by the procedure's code.
To declare an EXTENSIBLE procedure, specify:
The data type of the return value (optional)
The keyword PROC
The procedure identifier
The formal parameter list, enclosed in parentheses
The keyword EXTENSIBLE, followed by a semicolon
The formal parameter declarations, each followed by a semicolon
The procedure body—a BEGIN-END construct that can include local data
declarations, subprocedure declarations and statements
Following is an example of an EXTENSIBLE procedure declaration:
PROC x (a, b, c) EXTENSIBLE; !Declare EXTENSIBLE procedure
INT a;
INT(32) b;
FIXED c;
BEGIN
!Process the parameter values
END;
Checking for Actual Parameters
Each EXTENSIBLE procedure must check for the presence or absence of actual
parameters that are required by the procedure's code. The procedure can use
$PARAM to check for required or optional parameters.