Defining an Array Value Field
Use this procedure to define array value fields.
An array value field can access a specific value in an array or sum the values in an array.
An array is an easy way to keep track of a list of data. For example, a file stores the company monthly balances. Because there are 12 months, you can store each monthly balance in a single field.
Field Name Occurs Type Size
-------------------------------------------------------------------
Balance 1 Signed 11.2
Balance 1 Signed 11.2
Balance 1 Signed 11.2
.
.
.
Alternatively, you can store the balances in an array field that has 12 values (occurs 12 times), one for each month.
Field Name Occurs Type Size
-------------------------------------------------------------------
Balances 12 Signed 11.2
A subscript lets you reference each value in the array. For example, the balance of the first month is subscript 1 of the field Balances; the balance of the second month is subscript 2 of the field Balances, and so on.
The following array value field, Mnth-3-Balance, accesses a specific value (subscript 3) in the array Balances from the Sales file.
You can also use a variable value, stored in a field, to access a specific array value. For example, the array value field Curr-Balance accesses the monthly balance for the current period. The Sales file stores the current period in the Current Period field. The Current Period field can be used to subscript the Curr-Balance array. If the value in the Current Period field is 5, the fifth value of the Balances field is the Curr-Balance.
You can also define an array value range subscript to add values in an array. For example, a subscript of 4 and a range subscript of 6 sums the fourth, fifth, and sixth values in the array field Monthly Sales.
To define an array value field