TAL Programmer's Guide
Declaring Procedures
Structuring Programs
3–8 096254 Tandem Computers Incorporated
Local Data Local data is data you declare inside a procedure and can access only from within that
procedure. Local data can be any data item described in Table 3-1 earlier in this
section. Within a procedure, all local data declarations must appear before any
subprocedure declarations or local statements. Following is an example of how you
declare local data:
PROC p;
BEGIN
INT total; !Declare local data
INT num;
!Subprocedures go here, if any
!Local statements go here
END;
Local Labels You can declare labels to reserve identifiers for later use as identifiers of locations in
the procedure. For example, you can declare a label named LABEL_ONE and place it
at a statement. Here is an example:
PROC x;
BEGIN
INT var;
LABEL label_one; !Declare a local label
!Lots of statements
label_one : !Place the label at this
var := 5; ! assignment statement
!More statements
END;
You can place the label identifier at the beginning of any statement, and then access
the label identifier from within the encompassing procedure. (You can apply label
identifiers without declaring them, but declaring them reserves their identifiers.)
Local Statements Statements perform specific operations. Local statements are those you include in a
procedure but outside a subprocedure. For example, to store a value in a variable, you
can use an assignment statement as follows:
PROC nonsense;
BEGIN
INT local_var;
local_var := 1000; !Local assignment statement
END;