HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)
4-: 121
100 SHORT REAL Fraction
120 SHORT REAL Reading1, Reading2(36,36)
130 REAL Distance
140 REAL Time1(0:35,1:36,3),Time2
REDIM
An array can be redimensioned explicitly or implicitly. The REDIM
statement explicitly redimensions one or more arrays. Unlike the DIM
statement, it is executable.
You can do the following by redimensioning an array:
* Change the bounds of one or more dimensions.
* Decrease the number of elements accessible.
Redimensioning cannot do the following:
* Change the number of dimensions.
* Change the element values.
* Change the storage order.
* Increase the original number of elements (the number of elements
assigned to it by the most recent call to the program unit that
declared it).
Syntax
REDIM
array dims
[,
array dims
]...
Parameters
array
Structured collection of variables of the same type.
The structure is determined when the array is declared.
String variables names are suffixed with a "$".
dims
Array dimensions used in syntax specification
statements. Its syntax is
(
dim1
[,
dim2
[,
dim3
[,
dim4
[,
dim5
[,
dim6
] ] ] ] ])
where
dim1
through
dim6
each have the syntax
[
num_expr1
:]
num_expr2
and
num_expr1
and
num_expr2
are the lower and upper
bounds (respectively) of the dimension. If
num_expr1
is
not specified, it is the default lower bound.
Examples
100 OPTION BASE 0
105 DIM A(1:4,3) !A is 4x4, with 16 elements.
110 DIM B(1,2,1:3) !B is 2x3x3, with 18 elements.
120 REDIM A(1:3,0:1) !A is now 3x2, with 6 elements.
130 REDIM B(1,1,2) !B is now 2x2x3, with 12 elements.
999 END
If A and B look like this before redimensioning:
A: 1 2 3 4 B: 1 2 3
5 6 7 8 4 5 6
9 0 1 2 7 8 9
3 4 5 6
1 2 3
4 5 6
7 8 9
then they look like this after redimensioning: