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

3- 39
BASIC/XL enters a subprogram, it initializes the environment. When
control returns to the calling program unit, HP Business BASIC/XL
reinstates the environment of the calling program unit.
Table 3-30 lists the characteristics that define the operating
environment of a program unit and explains how each characteristic is
initialized.
Table 3-30. Program Unit Operating Environment
---------------------------------------------------------------------------------------------
| | |
| Operating Environment | Initial Value |
| Characteristic | of Characteristic Upon |
| | Program Unit Entry |
| | |
---------------------------------------------------------------------------------------------
| | |
| Data pointer position. | First datum in first DATA statement in |
| | program unit. |
| | |
---------------------------------------------------------------------------------------------
| | |
| Accessible files. | Files passed as parameters and common files |
| | that program unit declares. |
| | |
---------------------------------------------------------------------------------------------
| | |
| Trigonometric unit. | Radians. |
| | |
---------------------------------------------------------------------------------------------
| | |
| Print format for numeric data. | Standard. |
| | |
---------------------------------------------------------------------------------------------
| | |
| Default lower bound for arrays. | Depends on OPTION BASE. |
| | |
---------------------------------------------------------------------------------------------
| | |
| ON ERROR specifications. | ON ERROR GOTO and ON ERROR GOSUB |
| | specifications that were active in the |
| | calling program unit are inactive; ON ERROR |
| | CALL specifications that were active in the |
| | calling program unit are active. |
| | |
---------------------------------------------------------------------------------------------
| | |
| ON END specifications. | ON END specifications that were active in |
| | the calling program unit are inactive. |
| | |
---------------------------------------------------------------------------------------------
Using Common Variables in Subunits
A subunit can declare an entire common area or an initial subset of a
common area that is declared in the main program. It can only access the
common variables that it declares.
A program unit declares common areas with COM statements. A subprogram
cannot contain common variables with the same names as its formal
parameters or local variables.
Example
10 COM A(4,4), B, INTEGER C, D(3,3), E$[28], F$(2,4)[56]