TAL Reference Manual
Procedures
TAL Reference Manual—526371-001
13-22
Usage Considerations
Usage Considerations
Labels are the only declarable objects that you need not declare before using them.
For best program management, however, declare all labels. For example, declaring a
label helps ensure that you access the label, not a variable that has the same identifier.
Local Labels
You can use a local label as follows:
1. Declare the label inside a procedure at the local level.
2. Place the label identifier and a colon (:) preceding a local statement in the same
procedure.
3. Branch to the label by using local or sublocal GOTO statements in the same
procedure.
Future software platforms require that you declare local labels that are referenced by
sublocal GOTO statements.
Sublocal Labels
You can use a sublocal label as follows:
1. Declare the label inside a subprocedure.
2. Place the label identifier and a colon (:) preceding a sublocal statement in the
same subprocedure.
3. Branch to the label by using sublocal GOTO statements in the same subprocedure.
Examples of Label Declarations
1. In this example, a local GOTO statement branches to a local label named ADDR:
PROC p;
BEGIN
LABEL addr; !Declare label
INT result;
INT op1 := 5;
INT op2 := 28;
addr:
result := op1 + op2; !Labeled statement
op1 := op2 * 299;
IF result < 100 THEN
GOTO addr; !Branch to label
!Some code
END;