Two-Dimensional Arrays
For example:
DEFINE_VARIABLE
NAMES[1Ø][3Ø]
PEOPLE[8][2Ø]
ONE_NAME[3Ø]
A_VALUE
DEFINE_PROGRAM
A_VALUE = 1Ø
ONE_NAME = 'EMMITT SMITH'
NAMES[1][1] = 6
NAMES[1][2] = A_VALUE
NAMES[2] = 'TROY AIKMAN'
NAMES[3] = "1,2,ONE_NAME,3" (* statement 6 *)
FIG. 18 shows what the two-dimensional array NAMES will look like after this code is executed.
FIG. 18 The two-dimensional array NAMES after the assignments
In this example, '6', '10', '1', '2', and '3' are decimal values; the letters are ASCII characters.
Each row in the two-dimensional array has a length value like a one-dimensional array. When a
string literal or expression is assigned to a row of a two-dimensional array (as shown in statements
5 and 6 in the above example), that row has its length value set in the same manner as a one-
dimensional array does. The LENGTH_STRING and SET_LENGTH_STRING functions operate
on rows in two-dimensional arrays in the same way as whole one-dimensional arrays. Once the
above example is executed, the LENGTH_STRING function returns the first three rows of
NAMES:
X = LENGTH_STRING (NAMES[1])
X = LENGTH_STRING (NAMES[2])
X = LENGTH_STRING (NAMES[3])
Retrieving values
There are three ways of referencing the contents:
!
!
!
Single locations (or cells) are retrieved by using two index values. The first index value specifies
the row, the second the location in that row. For example:
A_VALUE = NAMES[3][6]
60
(* two-dimensional array *)
(* another two-dimensional array *)
(* one-dimensional array *)
(* single-value variable *)
(* statement 1 *)
(* statement 2 *)
(* statement 3 *)
(* statement 4 *)
(* statement 5 *)
By cell (single values)
By row (an array of values)
As a whole
(* X will contain Ø *)
(* X will contain 11 *)
(* X will contain 15 *)
Axcess Programming Language
Need help?
Do you have a question about the AXCESS CONTROL SYSTEM PROGRAM and is the answer not in the manual?