Specifications
Chapter 14. Statement Reference
206
Syntax:
DIM arraydeclaration[,arraydeclaration...]
Parameter:
arraydeclaration
numericvariable (subscript)
DIM n1%(12)
DIM n2(5,6)
stringvariable (subscript)[
[stringlength]]
DIM s1$(2)
DIM s2$(2,6)
DIM s3$(4)[16]
DIM s4$(5,3)[30]
subscript
For one-dimensional: integerexpression
For two-dimensional: integerexpression,
integerexpression
Where integerexpression is a numeric expression which returns
a value from 0 to 254.
stringlength
An integer constant that has a value from 1 to 255 which indicates the
number of characters.
Description:
DIM declares array variables and dimensions the arrays that a program will utilize.
•A DIM statement can appear anywhere before the first use of the array in a
source program. However, when possible, you should place all your DIM state-
ments together near the beginning of the program and should not place them in
the program execution loops in order to prevent errors.
• Up to 2-dimensional array variables can be declared.
DIMension Memory control statement
DIM
Declares and dimensions arrays; also declares the string length for a string variable.