DIM [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation
HP Business BASIC/XL Reference Manual
DIM
The DIM statement declares one or more string or array variables.
Syntax
DIM type_list [,type_list]...
Parameters
{[type]num_item [, num_item]...}
type_list {non_num_item }
type One of the following:
SHORT INTEGER
INTEGER
SHORT DECIMAL
DECIMAL
SHORT REAL
SHORT (Current default type, either a REAL or a
DECIMAL)
REAL
unspecified
If a type is not specified, implicit declaration
rules apply. (These rules are explained in
"Implicit Declaration" in chapter 3). After type,
each num_item is of that type until another type
or a non_num_item appears.
num_item A numeric variable name or a numeric array
declaration. A numeric array is declared as:
identifier [(array_subscripts)]
non_num_items A scalar string variable name or a string array
declaration. A scalar string variable can be
declared as either of the following:
{identifier$ }
{identifier$[num_expr3]}
The first declaration results in a scalar string
variable that can contain a maximum of 18
characters (default length). The second
declaration specifies the maximum length that the
string may contain is num_expr3 characters.
A string array is declared as either of the
following:
{identifier$(array_subscripts) }
{identifier$(array_subscripts)[num_expr3]}
In the first declaration, each element of the
array can have a maximum length of 18 characters
(default value). In the second declaration, the
maximum length of each element is num_expr3
characters.
array_subscripts A list specifying each dimension. Each dimension
is separated from the next by commas. An array
has between one and six dimensions. The default
is one dimension.
dimension A single number or a pair of numbers that has the
syntax:
[num_expr1:]num_expr2
num_expr1 Lower bound for the dimension. If the DIM
statement is in the main program unit, the value
of num_expr1 must be constant. num_expr1 is less
than or equal to num_expr2. The default is
default lower bound specified in the appropriate
OPTION BASE statement or the HP Business BASIC/XL
configuration file.
num_expr2 Upper bound for the dimension. If the DIM
statement is in the main program unit, the value
of num_expr2 must be constant.
num_expr3 Maximum length of each string in the array. The
default length is 18.
Examples
10 !Numeric Arrays
20 DIM Default_type_Arr(20)
30 DIM INTEGER Int_Arr1(40)
40 DIM REAL Real_Arr3(10:20,10,9)
50 DIM DECIMAL Dec_Arr(40), Dec_Arr2(10,4), REAL Real_Arr2(2,2:4)
10 !String Arrays
20 OPTION BASE 1
30 DIM Default_length_string$
40 DIM Str_len_80$[80]
50 DIM Str_arr1_len_80$(10)[80]
60 DIM Str_arr2_len_20$(10:15,-10:0,5,3)[20]
MPE/iX 5.0 Documentation