Label data and LABEL attribute
>>-LABEL--+--------------------------+------------------------->< | .-,--------------. | | V | | '-(----label-constant-+--)-'
If a list of label constants is given, the variable must always have as its value a member of that list, and the label constants in the list must be known in the block containing the label declaration. The parenthesized list of label constants can be used in a LABEL attribute specification for a label array.
Abcde: Miles = Speed*Hours;
The labelled statement can be executed either by normal sequential
execution of instructions or by using the GO TO statement to transfer
control to it from some other point in the program.A label variable can have another label variable or a label constant assigned to it. When such an assignment is made, the environment of the source label is assigned to the target. If you declare a static array of labels to have initial values, the array is treated as nonassignable.
declare Lbl_x label;
Lbl_a: statement;
.
.
.
Lbl_b: statement;
.
.
.
Lbl_x = Lbl_a;
.
.
.
go to Lbl_x;
Lbl_a and Lbl_b are label constants, and Lbl_x is a label variable. By assigning Lbl_a to Lbl_x, the statement GO TO Lbl_x transfers control to the Lbl_a statement. Elsewhere, the program can contain a statement assigning Lbl_b to Lbl_x. Then, any reference to Lbl_x would be the same as a reference to Lbl_b. This value of Lbl_x is retained until another value is assigned to it.
go to Z(I);
.
.
.
Z(1): if X = Y then return;
.
.
.
Z(2): A = A + B + C * D;
.
.
.
Z(3): A = A + 10;
If Z(2) is
omitted, GO TO Z(I) when I=2 raises
the ERROR condition. GO TO Z(I) when I < LBOUND(Z) or I >
HBOUND(Z) causes unpredictable results if the SUBSCRIPTRANGE
condition is disabled.