The DIMENSION statement specifies the shape or rank of an array.
SyntaxDIMENSION [::] array-name (array-spec) [, array-name (array-spec)] ...Where:
array-name is the name of an array.
array-spec is explicit-shape-specs
explicit-shape-specs is a comma-separated list of [lower-bound :] upper-bound that specifies the shape and bounds of an explicit-shape array.
assumed-shape-specs is a comma-separated list of [lower-bound] : that, with the dimensions of the corresponding actual argument, specifies the shape and bounds of an assumed-shape array.
deferred-shape-specs is a comma-separated list of colons that specifies the rank of a deferred-shape array.
assumed-size-spec is [explicit-shape-specs,] [lower-bound :] *
assumed-size-spec specifies the shape of a dummy argument array whose size is assumed from the corresponding actual argument array.
lower-bound is a scalar INTEGER expression that can be evaluated on entry to the program unit that specifies the lower bound of a given dimension of the array.
upper-bound is a scalar INTEGER expression that can be evaluated on entry to the program unit that specifies the upper bound of a given dimension of the array.
If the object being dimensioned also has the ALLOCATABLE or POINTER attribute, array-spec must be specified as a deferred-shape.
Example 1program prog1 dimension :: a(3,2,1) ! dimension statement real, dimension(3,2,1) :: b ! dimension attribute dimension c(-3:3) ! bounds specified real d allocatable d dimension d(:,:,:) ! deferred shape with rank 3
Example 2subroutine sub1(x,y,z) dimension :: x.:,:,:) ! assumed shape with rank 3 dimension y.-3:) ! lower bound specified dimension z(*) ! assumed size array