Directives
RUN Transfer and Execute a Program
   
Format RUN [prog$[;entry$]][,ERR=stmtref]
 
Where:
;entry$ Name of starting statement label to use as entry point in the program. Optional. If included, append to the prog$ string expression
(e.g., RUN "MY_PROG;STARTING_LABEL").
prog$ Name of the program to load and execute. Optional. String expression.
stmtref Program line number or statement label to which to transfer control.
   
Description Use the RUN directive to start or resume the execution of a program. You can include the name of a program to LOAD and then RUN.

If the current program is at an interupted state (due to program error, ESCAPE directive, or interupt), a RUN command will simply resume execution. If not at an interupted state, the RUN directive performs the following actions prior starting execution:

  1. Clears FOR/NEXT, GOSUB/RETURN, and WHILE/WEND stack.
  2. Resets SETERR and SETESC addresses and any saved RETRY address.
  3. If you the system parameter 'RR' is set and a program name is specified, the system will also perform a RESET prior starting execution.

If you are loading a program or if the current program has not been interrupted, ProvideX begins execution at the program statement with the lowest line number. If the current program was interrupted (by an error, or a BREAK or ESCAPE directive) ProvideX resumes execution from the statement where the program left off.

You can embed the RUN directive in a program to provide an overlay facility. The RUN directive affects neither user data nor files.

When you use it in a compound statement, the RUN directive must be the final directive.

You can assign an optional line label entry point for the RUN program. To do this, append a semicolon and the starting label name to the program name (e.g., RUN "PROG;STARTING_LABEL"). After the program is loaded, ProvideX internally issues a GOTO directive and starts execution at the assigned entry point.

PxPlus allows the specification of a line number instead of a label. To specify a line number, the entry point must consist of a pound sign (#) followed by the line number. (e.g. RUN "ProgABC;#1000" would start at statement 1000 in ProgABC).

  Specifying a line number as an entry point is an +PxPlus Exclusive
   
See Also CALL Transfer to Subprogram,
PERFORM Call Subprogram, Pass Variables,
RESET Reset Program State,
'RR' System Parameter.
   
Example -> RUN "INVGEN"
0040 RUN "PAY"+A$