Introduction MTB Statements File System Compiler Applications Reference Guide Index

Language Structure Data Division I/O Format Division Procedure Division Mnemonics

RUN statement

Syntax: RUN program [,DIR=directory] [,EXCP=statement-label]
Discussion: The RUN statement terminates the current program and calls in another program to be loaded and executed in the same partition. Because it causes an exit from the current program and transfers control to the called program, RUN is the last statement to be executed.

You cannot return to the original program automatically. It must be recalled by another RUN statement.

Also see ACTIVATE and ENTER.

Example 1:
RUN "MAINMENU",DIR="DSK"
In this example, the RUN statement runs a program called MAINMENU, which is located on directory DSK.
Example 2:
IF OPTION$="QUIT" THEN RUN "QMONITOR"
In this example, the variable named OPTION$ is tested. If OPTION$ is equal to "QUIT," the QMONITOR program is executed.