TAL Programmer's Guide
Declaring Procedures
Using Procedures
11–2 096254 Tandem Computers Incorporated
Declaring Procedures To declare a procedure in its simplest form, specify:
The keyword PROC
The procedure identifier, followed by a semicolon
The procedure body—a BEGIN-END construct that can include data declarations,
subprocedure declarations, and statements
Here is an example of a procedure declaration:
PROC my_proc; !Declare procedure MY_PROC
 BEGIN
 INT var; !Declare local data
 !Declare subprocedures, if any
 var := 99; !Specify local statements
 CALL some_proc;
 END; !End MY_PROC
Calling Procedures When you run your program, a procedure is activated by a CALL statement in another
procedure or subprocedure (the caller).
For example, a caller can call the preceding procedure (MY_PROC) as follows:
PROC caller_proc; !Declare CALLER_PROC
 BEGIN
 !Lots of code
 CALL my_proc; !Call MY_PROC
 !More code
 END; !End CALLER_PROC
When the called procedure finishes executing, control returns to the statement
following the CALL statement in the caller.










