
Two-Dimensional Arrays
60
Axcess Programming Language
For example:
DEFINE_VARIABLE
NAMES[1Ø][3Ø] (* two-dimensional array *)
PEOPLE[8][2Ø] (* another two-dimensional array *)
ONE_NAME[3Ø] (* one-dimensional array *)
A_VALUE (* single-value variable *)
DEFINE_PROGRAM
A_VALUE = 1Ø (* statement 1 *)
ONE_NAME = 'EMMITT SMITH' (* statement 2 *)
NAMES[1][1] = 6 (* statement 3 *)
NAMES[1][2] = A_VALUE (* statement 4 *)
NAMES[2] = 'TROY AIKMAN' (* statement 5 *)
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.
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 will contain Ø *)
X = LENGTH_STRING (NAMES[2]) (* X will contain 11 *)
X = LENGTH_STRING (NAMES[3]) (* X will contain 15 *)
Retrieving values
There are three ways of referencing the contents:
!
By cell (single values)
!
By row (an array of values)
!
As a whole
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]
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.
Summary of Contents for Axcess
Page 1: ...instruction manual Software Axcess Programming Language ...
Page 8: ...vi Axcess Programming Language Table of Contents ...
Page 12: ...Introduction 4 Axcess Programming Language ...
Page 22: ...Axcess Basics 14 Axcess Programming Language ...
Page 38: ...Channel Characteristics 30 Axcess Programming Language ...
Page 54: ...Levels 46 Axcess Programming Language ...
Page 62: ...Operators 54 Axcess Programming Language ...
Page 66: ...Variable Types and Conversions 58 Axcess Programming Language ...
Page 70: ...Two Dimensional Arrays 62 Axcess Programming Language ...
Page 80: ...While Keywords 72 Axcess Programming Language ...
Page 86: ...Using Buffers 78 Axcess Programming Language ...
Page 94: ...Waits and Timer Keywords 86 Axcess Programming Language ...
Page 102: ...Using Subroutines 94 Axcess Programming Language ...
Page 108: ...Include Files and System_Calls 100 Axcess Programming Language ...
Page 120: ...Compiler Error Messages 112 Axcess Programming Language ...
Page 124: ...The External_Control Protocol 116 Axcess Programming Language ...