HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)
4- 98
TRACE
MAIN NONEWCOM
OPTION and GLOBAL OPTION statements are processed immediately before the
program units containing them are run. Neither statement can be used as
a command.
The MAIN and SUBPROGRAM global options are used chiefly for compiling
multi-program applications. A program that uses the SUBPROGRAM option
can only be run by execution of a GET program line from within an
executing program. Trying to RUN a program in the interpreter that has a
GLOBAL OPTION SUBPROGRAM statement results in an error. Programs that
contain the GLOBAL OPTION MAIN can be executed by using the RUN command
in the interpreter as well as by executing a GET statement for that
program in an executing program.
A suboption of the MAIN/SUBPROGRAM option is NONEWCOM or NEWCOM. The
suboption relevant at the execution of the GET statement is that in the
called program unit, not that suboption present in the caller. The
NONEWCOM suboption prevents the deletion and addition of COM areas
regardless of whether the called program uses the COM area. COM areas
named in both the calling and called programs are checked to ensure that
the declarations in each match. NONEWCOM is the active suboption if
neither suboption is specified. The NONEWCOM suboption causes every
programmatic GET to compare COM area names. Any COM areas not named in
both programs are deleted and any COM areas named only in the new program
are created.
Examples
The comments in the following example explain the extent that local
OPTION statements override the GLOBAL OPTION statement in the main
program.
100 GLOBAL OPTION DECIMAL, INIT, DECLARE, BASE 0
.
.
125 CALL Sub1
.
.
150 CALL Sub2
.
.
175 CALL Sub3
.
.
200 SUB Sub1
210 OPTION REAL, NOINIT !Options: REAL,NOINIT,DECLARE,BASE 0
.
.
250 SUBEND
300 SUB Sub2
310 OPTION NODECLARE
320 OPTION BASE 1 !Options: DECIMAL, INIT, NODECLARE, BASE 1
.
.
350 SUBEND
400 SUB Sub3
410 OPTION DECIMAL !Options: Same as global options
.
.
450 SUBEND
999 END
Each of the following three programs declares the variable A implicitly.
In the first and third programs, A is real. In the second program, A is
decimal.