bas7advr.hlp (
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
RUN Statement Details
◄Syntax► ◄Details► ◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
Restarts the program currently in memory, or executes a specified program.
RUN [{linenumber | filespec$}]
■ You do not need to specify the filename extension in filespec$. The
.BAS extension is assumed in the QBX environment. BASIC assumes the
.EXE extension for compiled, stand-alone programs. If the program
you wish to run has a different extension, you must give the
extension. If the program name has no extension, the filename
given must end with a period. For example,
RUN "CATCHALL"
would execute CATCHALL.EXE from a BC-compiled program, and
CATCHALL.BAS from within the QBX environment.
Usage Notes
■ The line where execution begins must be in the module-level code.
Therefore, a RUN statement in a SUB or FUNCTION procedure must point
to labels at module level. If no line label is given, execution
always starts with the first executable line of the main module.
■ Program lines can have line numbers or alphanumeric labels, such as
OpenWindow:. However, the RUN statement does not accept an
alphanumeric label. If an alphanumeric label is the target of a RUN
statement, the compiler generates the error message, "String
expression required."
■ Programs running within the QBX environment must call only BASIC
program files. The file is loaded and run as if it were a BASIC
program; if it is not in the BASIC program format, execution halts.
The error message that is displayed varies, depending on the file's
contents. Likewise, programs compiled with BC must not invoke BASIC
source files, as these run only in the QBX environment.
■ An executable file need not have been written in BASIC. Any
executable file can be run.
■ When running a program under QBX, if an executable file matching the
filename in commandline cannot be found, BASIC generates the error
message, "File not found" and control returns to QBX. When running a
program compiled by BC, the error message, "File not found in module
programname" is displayed, and control returns to the operating system.
■ When the invoked program completes execution, control does not return
to the invoking program. If the invoking program ran outside QBX,
control returns to the operating system. If the invoking program ran
under QBX, control returns to QBX.
■ RUN closes all files and clears program memory before loading the
designated program. The BC compiler does not support the R option
from BASICA. (The R option keeps all open data files open.) If you
want to run a different program, but leave open files open, use the
CHAIN statement.