Array References

Dimensioned and Dynamic arrays can be referenced in BASIC programs.

Dynamic (or string) array references have the forms:

Form

Description

dyn.array.var<ac.exp>

References an entire attribute location of a dynamic array.

dyn.array.var<ac.exp, vc.exp>

References a value within an attribute.

dyn.array.var<ac.exp, vc.exp, sc.exp>

References a subvalue within a value.

Dimensioned arrays have a maximum of two dimensions and must first be defined with a dim or dimension statement. The first form is a one-dimensioned array or vector:

if array<ac.exp,1,sc.exp> = "xxx" then...

The second form is a two-dimensioned array or matrix:

dim dim.array.var(row.exp, column.exp)

Dimensioned array references have the forms:

Form

Description

dim.array.var(element.exp)

References an element of a dimensioned array or vector.

dim.array.var(element.exp)<ac.exp, vc.exp>

References a value within an attribute of an element in a dimensioned array or vector.

dim.array.var(element.exp)<ac.exp, vc.exp, sc.exp>

References a subvalue within a value of an element in a dimensioned array or vector.

When used in conjunction with the file statement, dimensioned array elements can be referenced by the actual item-ID of the attribute-defining item in the associated dictionary:

file entity

.

.

if fv.entity(name) = "" then

Combining Dimensioned and Dynamic Array Elements

A specific value or subvalue of a dimensioned array can be specified using these forms:

dim.array.var(ac.exp)<ac.exp, vc.exp>

This references the element of the dimensioned array derived from the current value of ac.exp. Within this array element, the value count derived from vc.exp is referenced.

dim.array.var(ac.exp)<ac.exp, vc.exp, sc.exp>

As in the previous case, with the additional reference to a subvalue location derived from sc.exp.

Syntax

dim.array.var(element.exp)

dim.array.var(row.num,col.num)

dim.array.var(element.exp)<ac.exp, vc.exp, sc.exp>

 

dyn.array.var<ac.exp>

dyn.array.var<ac.exp, vc.exp>

dyn.array.var<ac.exp, vc.exp, sc.exp>

Example(s)

Assigns the value of name to the first element of the dimensioned array customer.item.

customer.item(1) = name

Assigns the value of address2 to the second value in the second attribute of dynamic array customer.item.

customer.item<2,2> = address2

Searches for any element in the dimensioned array array equal to the letter x.

if dim.array.var(element.exp) = "x" then...

Tests for value vc.exp of attribute 2 in the dynamic array customer.item equal to a null string ("").

if customer.item<2,vc.exp> = "" then...

Tests for any value of attribute 2 in the dynamic array customer.item equal to a null string ("").

if customer.item<2,*> = "" then...

Tests for subvalue sc.exp in value vc.exp in attribute ac.exp in the dynamic array customer.item equal to a null string ("").

if customer.item<ac.exp,vc.exp,sc.exp> = "" then...

Tests for any subvalue in any value in any attribute in the dynamic array customer.item equal to a null string ("").

if customer.item<*,*,*> = "" then...

See Also

() Reserved Characters

> Relational Operator

Array Variable

Assignment

Attribute Count Expression

extract() Function

insert() Function

locate Statement

lt Relational Operator

matread Statement

matwrite Statement

Numeric Expressions

read Statement

replace() Function

Subvalue Count Expressions

Value Count Expression

write Statement