TAL Programmer's Guide

Using Labels
Using Procedures
11–50 096254 Tandem Computers Incorporated
Using Sublocal Labels To declare and use sublocal labels:
1. Declare the label identifier inside a subprocedure in the sublocal declarations; for
example:
LABEL sub_label; !Declare SUB_LABEL
2. Place the label identifier and a colon (:) preceding a statement in the same
subprocedure:
sub_label: !Use the label for
a := 5; ! this statement
3. Reference the label in a GOTO statement located in the same subprocedure.
You can branch to sublocal labels by using GOTO statements in the same
subprocedure:
INT op1, op2, result; !Declare global declarations
PROC p;
BEGIN
!Declare local variables
LABEL exit; !Declare local label EXIT
SUBPROC s; !Declare subprocedure
BEGIN
LABEL addr; !Declare sublocal label ADDR
op1 := 5;
op2 := 28;
addr: !Use label ADDR for
result := op1 + op2; ! this statement
IF result < 0 THEN !If overflow, exit the
GOTO exit; ! subprocedure to label EXIT
result := op2 * 2;
!Lots of code
IF result < 100 THEN !If result < 100, go to
GOTO addr; ! label ADDR
END; !End subprocedure
!Lots of code
exit: !Use label EXIT for
CALL s; ! this statement
!More code
END; !End procedure