Information icon IBM InfoSphere DataStage and InfoSphere QualityStage, Version 8.5
space Feedback

Dimension Statement

Defines the dimensions of one or more arrays. Not available in expressions.

Syntax

Dimension matrix (rows, columns) [ ,matrix (rows, columns) ] ...
Dimension vector (max) [ , vector (max) ] ...

matrix is a two-dimensional array to be dimensioned.

rows is the maximum number of rows in the array.

columns is the maximum number of columns in the array.

vector is a one-dimensional array to be dimensioned.

max is the maximum number of elements in the array.

Remarks

Arrays can be redimensioned at run time. You can change an array from one-dimensional to two-dimensional and vice versa.

The values of array elements are affected by redimensioning as follows:

If there is not enough memory for the array, the Dimension statement fails and a following InMat function returns 1.

To assign values to the elements of the array, use the Mat statement and assignment statements.

Example

This example illustrates how a matrix can be dimensioned dynamically at run time based on incoming argument values:

Subroutine MyRoutine(InputArg, ErrorCode)
   ErrorCode = 0
* InputArg is 2 comma-separated fields, being the dimensions.
   Rows = Field(InputArg, ",", 1)
   Cols = Field(InputArg ",", 2)
   Dimension MyMatrix(Rows, Cols)
   If InMat = 1 Then
   * Failed to get space for matrix - exit with error status.
      Call DSLogWarn("Could not dimension matrix","MyRoutine")
      ErrorCode = -1
   Else
   * Carry on.
      ...
   End

PDFThis topic is also in the IBM InfoSphere DataStage Server Job Developer's Guide.

Update timestamp Last updated: 2010-09-30