A direct array can be a word array or a character array. Direct arrays of type COMPLEX are not allowed.
A direct array can be used in any way that a nondirect array can be used. However, arbitrary use of direct arrays instead of normal arrays can seriously degrade overall system efficiency.
The dimensionality of a direct array is the number of bound pairs in its declaration. No more than 16 dimensions are allowed.
| Note: | There are subtle restrictions on the correct declaration and use of a direct array row equivalence in which the array row of the declaration is a row of an array reference, because the default state of a direct array reference variable is uninitialized. |
For more information on the OWN specification, array class, bound pair list, lower bound, and row selector, see ARRAY Declaration. For information on the direct array reference identifier, see ARRAY REFERENCE Declaration.
A direct array has attributes that can be programmatically interrogated and altered before, during, and after an actual I/O operation that uses the array.
Because a direct array can be used in performing direct I/O operations, a direct array is automatically unpaged (nonsegmented). For more information on direct I/O operations, see I/O Statement.
|
A DIRECT ARRAY declaration can also be used, instead of a LONG ARRAY declaration, to declare an array that is longer than the maximum limit for a long array. Doing so, however, disables normal system safeguards for array sizing and addressing, and could cause incorrect addressing of that array and data corruption on some system configurations. |
The maximum size of a long array is determined by the configuration of the system. Those limitations are imposed as safeguards to prevent data corruption. Declaring a direct array explicitly defeats those safeguards.
For example, a long array cannot be declared so large that a valid character pointer cannot be developed for any location in that array. The operating system discontinues the program when it encounters such a declaration during program or procedure initiation. Similarly, a long array cannot be the target of a RESIZE command that would cause it to exceed the limits and endanger the contents of the array.
Because these limits are explicitly disabled for a direct array, data in a very large direct array could be corrupted without warning by an invalid pointer. Even if the initial size of the array is within the system limitations, a direct array could be resized beyond those limitations.
Always make sure that your program accesses to a direct array do not cause data corruption.

Caution