Defining Arrays › Defining an Array
Defining an Array
This topic tells you how to create and fully define an array. This process includes selecting the fields for the array and defining the relative order of the fields by assigning sequential numbers to key fields.
- View the list of files. At the Edit Database Relations panel, type *a or *ARRAYS in the positioner field at the top of the panel and press Enter.
The list of the CA 2E reserved files displays.
- Zoom into the array file. Type Z next to the *Arrays file and press Enter.
The Edit Array panel displays.
- Define the array. Type the name of the new array under the Arrays heading in the first blank line and press Enter.
The name must be a unique array name. This field becomes an output-only field.
The default line data for the new array displays, including the following information:
- Sequence—Sequence of the key or composite key of the array in either ascending or descending order. The default for this field is ASCEND.
- Unique—Defines if the keys in the array must be unique or non-unique. Unique is the default.
- Elements—Defines the maximum number (9999) of elements that this array can hold. An element is a full array entry and not a field within that entry. The default is 100.
The following array sample could be used to accumulate Order Totals for each State/Branch combination:
Selecting Field and Key Details for Your Array
- Zoom into the array. Type Z next to the selected array and press Enter.
The Edit Array Details panel displays. This panel is where you specify the files and fields that are used to define the layout of the array entry.
- Specify the layout. Specify the file or field that defines this part of the array entry layout.
- Define source. Define the source of the field definitions. This source may specify file or *field.
- Specify the field. If the source of the field is *FIELD, specify the actual field in the next column (or select by entering ?).
- Specify the access path. If the source of the field is a file, specify the access path of the file (or *NONE for all fields for the file) in the second column.
- Type Z next to the line and press Enter to select the required fields from the access path.
The Edit Array Entries panel displays with a list of fields for the selected access path or file.
- Type + (plus) next to the fields you want to add to the array and press Enter.
- Type – (minus) next to selected fields you want to drop from the array and press Enter.
- Exit. Press F3 to exit panel.
The Edit Array Details panel redisplays with a list of selected fields.
- Select keys. Press F7 to select the keys for an array.
The Edit Array Key Entries panel displays.
Note that you must define a key for an array even if the array holds a single element.
- Select the key order for the fields. Type a number in the Key no. column that defines the relative order of the field in the composite key list. The lowest value (1) is the major key or first dimension of an array.
You have created and defined your array.
Note: 2E does not support numeric keys that can have negative values.
Copyright © 2014 CA.
All rights reserved.
|
|