Use the GOTO command in a program to pass control to the commands following the LABEL command.
Option
lblname
Specifies a 1 to 18 character name that labels a line to skip to when a GOTO command is executed in a command or procedure file.
About the GOTO Command
You should limit the use of the GOTO command because GOTO runs more slowly than other R:BASE control structures. Instead, when possible, use a WHILE loop, SWITCH structure, or IF structure to build the command-file logic. Never use GOTO to exit from a WHILE loop or SWITCH structure.
Using the LABEL Command with GOTO
GOTO must have a corresponding LABEL command within the same command block or file. The LABEL command may precede or follow GOTO in the same command file or, in a procedure file, within the same command block.
You can use a variable containing the name of the label instead of using the specific label name in the GOTO command. To do this, you must use a dot or ampersand variable to tell R:BASE to use the contents of a variable, rather than the variable name as the label name.
Examples
The following example uses a dotted variable containing the name of the label instead of using the specific label name in the GOTO command. If the variable was not a dotted variable, R:BASE would search for a label named vlabel. Because it is a dotted variable, R:BASE looks for the correct label name label1.
SET VARIABLE vlabel = 'label1'
GOTO .vlabel
The GOTO lexit command in the following example causes the commands following the ENDIF command to be skipped and the QUIT TO command to be run. The only way the commands between the IF structure and LABEL lexit command would be executed would be if the value of v1 is not greater than the value of .v2.
IF v1 > .v2 THEN
GOTO lexit
ENDIF
.
.
.
LABEL lexit
QUIT TO caller