CL Command Reference - GOTO
CL Command List > GOTO Reference
Description:
The Go To (GOTO) command is used in CL procedures for branching from one part of the program to another. The branching is to the label on another command that is specified on the Go To (GOTO) command. Branching can be either forward or backward, but the specified label must be inside the program. For a GOTO command in a subroutine, the branch target must be associated with the same subroutine.
Restrictions:
. This command is valid only within a CL procedure.
. Using GOTO to branch into or out of a subroutine is not allowed.
Examples:
LOOP: CHGVAR &A (&A + 1)
IF (&A *LT 30) THEN(GOTO LOOP)
The Change Variable (CHGVAR) command increases the value of &A by 1 until &A is equal to or greater than 30. The GOTO command is processed each time that the IF command tests the expression and the result is true; the GOTO command following the THEN parameter causes the procedure to branch back to the label LOOP on the CHGVAR command. Refer to the descriptions of the CHGVAR command and the IF command for additional explanations of their functions.