Elements, arrays, and major structure or unions are always allocated in connected storage. References to unconnected storage arise only when you refer to an aggregate that is made up of noncontiguous items from a larger aggregate. (See Cross sections of arrays.) For example, in the following structure the interleaved arrays A.B and A.C are both in unconnected storage.
1 A(10),
2 B,
2 C;
|
Abbreviations: CONN, NONCONN
The CONNECTED attribute is applicable only to noncontrolled aggregate parameters and can be specified only on level-1 names. It specifies that the parameter is a reference to connected storage only, and therefore, allows the parameter to be used as a target or source in record-oriented I/O, or as a base in string overlay defining. When the parameter is connected and the CONNECTED attribute is used, more efficient object code is produced for references to the connected parameter.
NONCONNECTED should be specified if a parameter occupies noncontiguous storage. In the following example the NONCONNECTED attribute specifies that the sum_Slice routine handles 1-dimensional arrays in which the elements may not be contiguous. In the first invocation, sum_Slice is passed the first row, which is in connected storage. In the second invocation, however, sum_Slice is passed the first column, which is in nonconnected storage.
dcl A(10,10) fixed bin(31);
display( sum_Slice( A(1,*) ) ); /* first row */
display( sum_Slice( A(*,1) ) ); /* first column */
sum_Slice:proc(X) returns(fixed bin(31));
dcl X (*) fixed bin(31) nonconnected; /* default */
return(sum(X) );
end;