TAL Programmer's Guide
11 Using Procedures
096254 Tandem Computers Incorporated 11–1
Procedures are program units that can contain the executable portions of a TAL
program and that are callable from anywhere in the program. Procedures let you
segment a program into discrete parts that each perform a particular operation such as
I/O or error-handling.
A procedure can call other procedures, one at a time, or it can call another procedure
that in turn calls another, and so on. It can pass parameters (arguments). It can
contain subprocedures, which are callable from various points within the same
procedure.
A function is a procedure or subprocedure that returns a value to the caller. A
function is also known as a typed procedure or a typed subprocedure.
This section discusses:
How to declare and call procedures and subprocedures
How to declare and pass parameters
How the compiler allocates storage for procedures and parameters
How the compiler provides parameter masks
How to declare and use labels
How to get the addresses of procedures and subprocedures
Procedures and
Code Segments
The procedures in a program are located in one or more code segments within the user
code space. A procedure can call a procedure that is located:
In the same (or current) segment
In another segment of the same code space
In the system code segment
In a system library segment
In a user library segment
The starting address of a procedure is known as the entry point. The operating system
records entry points in the following system tables:
System Table Content of Table Location of Table
Procedure Entry Point
(PEP) table
Entry points of all procedures located
in the current code segment
At the beginning of the current
code segment
External Entry Point
(XEP) table
Entry points of procedures located in
other code segments
Near the end of the current code
segment
When a procedure calls another procedure in the current segment, control passes to
the called procedure through the segment’s PEP table.
When a procedure calls a procedure in a another code segment, control passes out of
the current segment through its XEP table to the called procedure through the other
segment's PEP table.
You can declare procedures that are up to 32K words in size, minus the size of either:
The PEP table (for procedures in the lower 32K-word area of the code segment)
The XEP table (for procedures in the upper 32K-word area of the code segment)