5.6.3 Assigned GO TO Statement

The assigned GO TO statement transfers control to a statement label that is represented by a variable. An ASSIGN statement must establish the relationship between the variable and a specific statement label. Therefore, the transfer destination can change, depending on the most recently executed ASSIGN statement.

Assigned GO TO statements take the following form:

GO TO v[[,] (slist)]
v
Is an integer variable.
slist
Is a list of one or more labels of executable statements separated by commas.

On VAX processors, slist does not affect statement execution and can be omitted. On Alpha processors, slist can be omitted, but if it is present, the label assigned to v must be in slist.

Rules and Behavior

The assigned GO TO statement transfers control to the statement whose label was most recently assigned to the variable v. The variable v must have an integer data type and must have a statement label value assigned to it by an ASSIGN statement (not an arithmetic assignment statement) before the GO TO statement is executed.

Both the assigned GO TO statement and its associated ASSIGN statements must exist in the same program unit. Statements that receive control must also be in the same program unit and must be executable.

Examples

The first example is equivalent to GO TO 200:

ASSIGN 200 TO IGO
GO TO IGO

The second example is equivalent to GO TO 450:

ASSIGN 450 TO IBEG
GO TO IBEG, (300,450,1000,25)

For More Information:

For details on the ASSIGN statement, see Section 3.5.


Previous Page Next Page Table of Contents