GOSUB

Transfers control within the Proc to the internal subroutine with the specified label.

Syntax

GOSUB label

or

[ ] label

Syntax Elements

label specifies the command where Proc execution is to continue.

label is a number at the start of the line containing the command to be executed, separated from the command by at least one space.

Operation

The GOSUB command transfers control to the subroutine with the specified label and program execution continues from there, until an RSUB statement is encountered. The RSUB command then transfers control back to the line immediately following the GOSUB command that originally called the subroutine.

In the case of multivalued comparisons, instead of repeating GOSUB in each multivalued command, just use GOSUB once, followed by the labels separated by value marks (X'FD'). For example:

IF A = 1]2]3]4 GOSUB 100]150]200]250

Example

020 GOSUB 400
021 OENTER ACCOUNT NUMBER
.
.
.
035 400 O**** ILLEGAL ENTRY **** PLEASE RETYPE
036 RI
037 IP?
038 RSUB

This example transfers control to the subroutine with label 400. When the RSUB command is reached, program control returns to line 021, which is the line immediately following the GOSUB command.