Skip to content

RUN

Run Program

This directive transfers a copy of a program from a logical disk directory into task memory (if program-name is specified) setting the program line pointer to the first program line and commences execution of the program. If program-name is not specified, execution is commenced at the current setting of the program line pointer for the program already LOADed into task memory. This directive does not change the status of any channels or variables.

RUN [program-name] [,ERR=line-ref|,ERC=error-code]
program-name
is any string that identifies the specific program to be LOADed and executed.
line-ref
is the program line number or label to branch to if this directive produces an error.
error-code
is a programmer-defined error code. Valid values are positive or negative whole numbers.

If an attempt is made to RUN a program-name that cannot be found on the available logical disk directories, an ERR=12 results.

If program-name is specified and program-name file is loaded without error, the system:

1 Clears the task program memory area (not Data or I/O memory area).

2 Performs a RESET function:

  • Clears the return address stack
  • Sets ERR and CTRL to 0
  • Sets PRECISION to 2
  • Sets SETERR and SETESC to 0

3 LOADs a copy of the program from disk storage into the task program memory area.

4 Positions the program execution pointer to the first statement.

5 Commences execution of the program.

6 Does not clear task variables.

7 Does not close files or devices.

If an attempt is made to RUN a program-name that specifies a file that is not a program file, an ERR=17 results.

If an attempt is made to RUN a program which has an invalid size (too small or too large), an ERR=19 results. This is normally an indication that the program file specified by program-name has been incorrectly altered by some method other than a normal ENCRYPT, PSAVE, or SAVE directive.

RUN

commences execution at the current program statement in the program already loaded in task memory.

RUN "INDEX"

loads the program named INDEX and commences execution at its first program line.

RUN P$

If P$ = “INDEX”, has the same effect as the previous example.

LOAD directive

From the Thoroughbred Basic Language Reference, Volume III: R–Z, version 8.9.1. Open this page in the PDF