Transfers program execution to one of several internal subroutines or labels.
ON integer GOSUB label1[,label2][...]
ON integer GOTO label1[,label2][...]
||A positive non-zero integer that corresponds to the list of labels.
||Any valid label. The label name can be optionally followed by a colon (:).
statement is used to transfer execution to one of the labels
specified by the GOSUB
keyword. Which label to transfer execution to is specified by the integer
argument: a value of 1 transfers control to the first listed label
, a value of 2 transfers control to the second listed label
, and so forth.
For a GOTO
, this label identifies a line of code in the current program. For a GOSUB
, this label identifies an internal subroutine that is executed until a RETURN
statement is encountered. Execution then reverts to the line immediately following the ON...GOSUB
statement. (Execution of an internal subroutine can also terminate with an END
statement, which does not return control.)
argument value corresponds to line of code identified by a label
identifier. Non-numeric labels end with a colon character; this colon is option when specifying the label
© 1997-2019 InterSystems Corporation, Cambridge, MA