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

4- 16
A,B Integer
C,D Real
A$ String with maximum length of 7 characters
P,Q Default numeric type
X,Y,Z Decimal
#2 File designator
100 COM N,S$,N_array(1:5),S_array$(1:2,1:4)[6]
Variable(s) Type
N Default numeric type
S$ String with default maximum length (18)
N_array Array of default numeric type
S_array$ Array of strings with maximum length of 6
Example 2: Concatenation of Common Variable Lists If two COM statements
in the same program unit have the same area name, their variable lists
are concatenated.
Lines 200 and 210 are equivalent to line 300. Common area Area 3
contains the same variables whether the program unit contains lines 200
and 210 or line 300.
200 COM /Area3/ SHORT INTEGER J,K,L
210 COM /Area3/ REAL M,N,O, DECIMAL P,Q
300 COM /Area3/ SHORT INTEGER J,K,L, REAL N,N,O, DECIMAL P,Q
Example 3: Correspondence of Common Variables in Main and Subunit When
two program units declare the same common area, corresponding common
items refer to the same entities. The entities (for example, variables
or files) can have different names in different program units, however,
because the different names refer to the same areas in memory, they must
have the following:
* The same type.
* The same number of dimensions.
If the main program unit contains the statements:
10 COM /Area4/ REAL A,B$[60], INTEGER C, #8
20 COM /Area4/ DECIMAL E(1:25,1:50), F$(0:4,0:4,0:4)[12]
Then a subunit can contain the statements:
350 COM /Area4/ REAL X,Y$
360 COM /Area4/ INTEGER C, #10, DECIMAL E()
370 COM /Area4/ F$(*,*,*)
Corresponding variables are compatible:
Main Program Unit Program Subunit
REAL A REAL X
B$[60] Y$
INTEGER C INTEGER C
# 8 # 10
DECIMAL E(1:25,1:50) DECIMAL E()
F$(0:4,0:4,0:4)[12] F$(*,*,*)
If the main program unit assigns a value to the variable that it calls A,
and then calls the program subunit, the value of X is the same as that
assigned to A in the main because A and X are different names for the
same variable.
If the main program unit contains the statements:
10 COM /Area4/ SHORT REAL A, B$[60], INTEGER C, #15
20 COM /Area4/ DECIMAL E, F$(0:4,0:4,0:4)[12]
Then a procedure in the same program cannot contain the statements:
450 COM /Area4/ REAL Num, String$, SHORT INTEGER D