TAL Programmer's Guide

Using Procedure Options
Using Procedures
096254 Tandem Computers Incorporated 11–9
Declaring EXTERNAL
Procedures
An EXTERNAL procedure declaration lets the current compilation unit call a
procedure that is declared in another compilation unit. The other compilation unit can
be a system library, a user library, or a user file.
To declare an EXTERNAL procedure, specify the EXTERNAL keyword in place of the
procedure body:
PROC PROCESS_DEBUG_; EXTERNAL; !Declare EXTERNAL procedure
PROC issue_warning (param);
INT param;
EXTERNAL; !Declare EXTERNAL procedure
PROC a MAIN;
BEGIN
INT x, y, z;
!Manipulate X, Y, and Z
If x = 5 THEN CALL issue_warning (5);
!Call EXTERNAL procedure
CALL PROCESS_DEBUG_; !Call EXTERNAL procedure
END;
Declaring VARIABLE
Procedures
For a VARIABLE procedure, the compiler treats all formal parameters as if they were
optional, even if some are required by the procedure's code. If you add new
parameters to a VARIABLE procedure, all procedures that call it must be recompiled.
To declare a VARIABLE 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 VARIABLE, followed by a semicolon
The formal parameter declarations, each followed by a semicolon
The procedure body—a BEGIN-END construct that can include data declarations,
subprocedure declarations, and statements
Following is an example of a VARIABLE procedure declaration:
PROC v (a, b) VARIABLE; !Declare VARIABLE procedure
INT a; !Declare formal parameters
INT b;
BEGIN
!Lots of code
END;
Checking for Actual Parameters
Each VARIABLE procedure must check for the presence or absence of actual
parameters that are required by the procedure's code. The procedure can use the
$PARAM standard function to check for required or optional parameters.