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

4-: 17
460 COM /Area4/ Q$, DECIMAL A(*,*), B()
The conflict in type and /or dimension for each variable is:
Main Program Unit Program Subunit
SHORT REAL A REAL Num
INTEGER C SHORT INTEGER D
#15 Q$
DECIMAL E DECIMAL A(*,*)
F$(0:4,0:4,0:4)[12] B()
Within a program unit, the following variables cannot have the same name:
* A common scalar variable and a local scalar variable.
* A common array variable and a local array variable.
In most cases, the main program declares every common area that the
program uses, whether the main program uses it or not. Before HP
Business BASIC/XL executes the main program unit, it allocates space for
all common variables, using the default numeric type and default lower
bound set by GLOBAL OPTION statements.
A procedure need only declare the common areas that it uses. A procedure
can declare all or part of the defined common area (starting at the
beginning), but cannot add items to it.
Exceptions to the foregoing occur if the NEWCOM suboption of the
MAIN/SUBPROGRAM global option is used. If NEWCOM is specified in the
current procedure, then, when the procedure begins execution, new common
areas in the subunit that are not declared in the main program are
allocated space. Also, the space for common areas declared in the main
program that are not used in the procedure is deallocated.
Examples
If the main program unit contains the COM statements:
10 COM /Area5/ INTEGER A,B, REAL C,D, DECIMAL E,F
20 COM /Area5/ A$,B$,C$
Then a procedure can declare all of Area5:
100 COM /Area5/ INTEGER X,Y
110 COM /Area5/ REAL R1,R2
120 COM /Area5/ DECIMAL D1,D2
130 COM /Area5/ A$, B$, C$
Or part of Area5, starting at the beginning:
200 COM /Area5/ INTEGER Part1,Part2, REAL Part3, Part4
210 COM /Area5/ DECIMAL D
But a procedure cannot omit the beginning of Area5:
300 COM /Area5/ REAL P,Q
310 COM /Area5/ DECIMAL D1,D2
And it cannot add to Area5:
400 COM /Area5/ INTEGER Int1,Int2, REAL Real1,Real2
410 COM /Area5/ DECIMAL Dec1, Dec2, A$, B$, C$
420 COM /Area5/ SHORT Sh1, Sh2, Sh3
Common variables are initialized as explained in "Initializing
Variables," in chapter 3.
COMMAND
The COMMAND statement executes a string expression as if its value were a
program line.
Syntax
COMMAND
str_expr