Caché ObjectScript Reference
Dimensions an array of variables for MultiValue use.
||Optional A postconditional expression. For further details, refer to Command Postconditional Expressions in Using Caché ObjectScript.
||Name of an array. Follows standard MVBasic variable naming conventions.
||An integer specifying the number of array elements to dimension for a one-dimensional array, or the number of rows to dimension for a two-dimensional array.
||Optional For two-dimensional (matrix) arrays, an integer specifying the number of columns per row. Can only be used in conjunction with the optional rows argument.
command explicitly dimensions a one-dimensional or two-dimensional MultiValue static array. Dimensioning of arrays is required for MultiValue applications.
Most MultiValue systems require you to explicitly dimension the rows
of a static array. These values specify the maximum number of elements that can be defined for that array. An explicitly dimensioned array is limited to two subscripts. It can be either one-dimensional, representing a vector array, or two-dimensional, representing the rows and columns of a matrix array. A one-dimensional array can be dimensioned either as a vector array: MVDIM arrayname(n)
or a matrix array with a column dimension of one: MVDIM arrayname(n,1)
The subscripts of a dimensioned array can be specified using named variables, as well as numeric indices. Variables whose names begin with a % are known as public arrays and their values are preserved across SUBROUTINE calls in a similar manner to COMMON arrays. Variables whose names begins with ^ are known as globals and their values are stored on disk automatically. Variables with normal naming conventions are known as local arrays and their value is lost when the program terminates, as with any other variable.
All uninitialized variables are treated as zero-length strings ("").
Caché MVBasic also allows you to dimension arrays of an arbitrary number of dimensions. This allows MVBasic to support the multidimensional arrays used in Caché. You specify a multidimensional array using a DIM statement with empty parentheses: DIM arrayname()
. This declares array
as a dimensioned array, but the number of dimensions and number of elements in each dimension may be expanded dynamically at runtime. Because Caché ObjectScript normally creates arrays of this type, the MVDIM
command does not provide an option for this type of implicit dimensioning.
The following examples illustrate the use of the MVDIM
; Dimensions a one-dimensional array with 10 elements.
/* Dimensions a two-dimensional matrix array
with 10 rows and 10 columns. */
/* Dimensions a two-dimensional array using local variables */