Default dimension variables (sys.Col, sys.Row, sys.Plane, sys.Dim4)

sys.Col,,u2

Default subscript for the first dimension

sys.Row,,u2

Default subscript for the second dimension

sys.Plane,,u2

Default subscript for the third dimension

sys.Dim4,,u2

Default subscript for the fourth dimension

These four variables store the current default subscripts of array fields. The default subscript represents the value to be used if no subscript is explicitly specified when the array field is referenced.

The variables may be updated directly, or by means of a set of four related commands which allow not only direct assignment, but also the increment or decrement of the current value of the variable.

Single-dimension arrays: The default subscript is stored in sys.Row and set by the setrow command.

Examples of a single dimension array:

!temp Lottery,,u1[7]
!temp Address,,a30[5]

Multi-dimensional arrays: A field may be allocated up to four dimensions. If a field has more than one dimension, these rules are followed:

Dimension

1

The default subscript is stored in sys.Col and set by the setcol command.

2

The default subscript is stored in sys.Row and set by the setrow command.

3

The default subscript is stored in sys.Plane and set by the setplane command.

4

The default subscript is stored in sys.Dim4 and set by the setdim4 command.

This array has three dimensions:

!temp Exchange,,n4.2[10,5,3]

Note that sys.Row, the default subscript for single-dimension arrays, is used for the second dimension of multi-dimensional arrays.

Individual elements of array fields can be referred to explicitly (e.g. PR.price[3,5,1]), or implicitly. If no dimensions are specified, then the current values of sys.Col, sys.Row, sys.Plane and sys.Dim4 are used to determine the array element which is being referred to.

The following two pieces of code reference the same element of st.price:

(a)  st.price[5,3,1] = 5600

(b)  setcol 5
     setrow 3
     setplane 1
     st.price  = 5600

In (a), sys.Col, sys.Row and sys.Plane have not been affected.

In (b), sys.Col has been set to 5, sys.Row to 3 and sys.Plane to 1.

The value of sys.Row determines which row will be used when a clear, display or input command is assigned to a multi-row textbox. Multiple rows are assigned to a textbox by means of the rows = clause.

Since Sculptor version 6.2.0 their value may be 0, when the four variables are set to 0, a whole field array copy may be done at once, see assigning two field arrays. Note that when setting one of the above system variables to a value != 0, and accessing then an array field, the rest is automatically initialised to 1. Meaning that you’ll have to reset the four of them again to 0 if you want the whole array to be copied.


EXAMPLE

Read from a temporary array into a file field. Both must be multidimensional:

!temp NextPrice,,n4.2[10,5]

     while (sys.Col < 11) {
          Stock.price = tmp.NextPrice
          setcol + 1
    }

RELATED TOPICS

Field dimensions