Commands and Statements |
RUN
The RUN command starts the execution of a program or a set of programs. If you enter RUN alone, it executes the current program starting at the lowest line number. If you enter RUN followed by a line number, it executes the current program start- ing at the specified line number. If you enter RUN followed by a string variable representing a file name, it looks for a file with that name on disk, loads its contents into memory, and executes the program starting at the lowest line number. With the latter form, an "F" may be added to leave files open. Otherwise, they are closed. Files can be left open only if the program was saved in
RUN [line numberlstring expression [,F]]
The RUN command may also be used as a program statement to chain programs together. The form of the RUN command that performs this function is:
line number RUN "filename"
This feature is especially useful for the execution of programs that are larger than can fit into memory as one large program. The RUN command initializes all variables to zero, however, so if you want to pass some variables to the next pro- gram, print them out to a buffer file (see the section on "Random Disk 110" for details) during execution of the first program. Then read them, when needed, into subsequent programs.
In the example below, the (tC) character halts program execution.
LIST
10INPUT A,B,C
20 PRINT (A+B+C+)/3
30PRINT"NEXT SERIES"
40PRINT: PRINT: PRINT
50GOTO 10
60END
RUN
?41,12,6
19.6
NEXT SERIES
?tC (This control character interrupts execution)
BREAK IN 10 OK
RUN 30 NEXT SERIES
?
SAVE
The SAVE command stores the current program on disk with the specified filename. The addition of a comma and an A saves the file in ASCII format. Note that if a file with the specified name exists, it will be replaced by the new file. Any valid