HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)

4-: 99
10 OPTION REAL 10 OPTION DECIMAL 10 REM No option specified
20 A = PI 20 A = PI 20 A = PI
99 END 99 END 99 END
In the first and second programs below, the variables are initialized to
zero when the program is run; in the third, they are not.
10 OPTION INIT 10 REM No option specified 10 OPTION NOINIT
20 INTEGER X,Y,Z 20 REAL A,B,C,D,E 20 DECIMAL P,Q
99 END 99 END 99 END
In the first and second programs below, implicit variable declaration is
legal. Numeric variable X and string variable A$ are implicitly
declared, and no error occurs. In the third program, implicit variable
declaration is illegal. A run-time error occurs at line 20.
10 OPTION NODECLARE 10 REM No option specified 10 OPTION DECLARE
20 X = 4535 20 X = 4535 20 X = 4535
30 A$ = "Hi" 30 A$ = "Hi" 30 A$ = "Hi"
99 END 99 END 99 END
Each of the following programs declares numeric array A and string array
B$. In the first and second programs, the arrays have lower bounds zero.
Therefore, A has six elements and B$ has 15 (three rows and five
columns). In the third program, the arrays have lower bound one. Array
A has five elements and B$ has eight (two rows and four columns). For
more information, see "Array Variables" in chapter 3.
10 OPTION BASE 0 10 REM No option specified 10 OPTION BASE 1
20 DIM A(5) 20 DIM A(5) 20 DIM A(5)
30 DIM B$(2,4) 30 DIM B$(2,4) 30 DIM B$(2,4)
99 END 99 END 99 END
An example of the MAIN/SUBPROGRAM global option requires the definition
of a program file in addition to the program currently in the
interpreter. The example demonstrates the allocation of new and
deallocation of old common areas.
>LIST
10 ! current program in the interpreter
20 GLOBAL OPTION MAIN NONEWCOM
30 COM /Com1/ Main1,Main2
40 COM /Com2/Main3,Main4
50 Main1=1;Main2=2;Main3=3;Main4=4
.
.
.
>RUN
1 2 0 0
>LIST
! SUBFILE
10 ! program in SUBFILE
20 GLOBAL OPTION SUBPROGRAM NEWCOM
30 COM /Com1/ Sub1,Sub2
40 COM /Com3/ Sub3,Sub4
50 PRINT Sub1;Sub2;Sub3;Sub4
The NONEWCOM/NEWCOM option in the called program in SUBFILE states that
new common areas can be allocated. This allows allocation of Com3.
Since Com2 is not used in the program in SUBFILE, Com2 is deallocated.
As can be seen by program execution, the values assigned to the Com1
common area variables in the callee are those referenced by the variables
in Com1 in the called program.