An array is an n-dimensional collection of elements that have identical attributes. Only the array itself is given a name. An individual item of an array is referred to by giving its position within the array. You indicate that a name is an array variable by providing the dimension attribute.
Unless specified using REFER, every dimension of every array must have at least one element. When the bounds of an array are specified using REFER, then the array may be defined to have zero elements as long as
So, for example, given the following code, it would be valid to allocate the array a when n1 was zero as long as ab3, abc1 and abc2 were neither accessed nor assigned.
dcl n1 fixed bin(31);
dcl p pointer;
dcl
1 a based(p),
2 ab1 fixed bin(31),
2 ab2 fixed bin(31),
2 ab3( n1 refer(ab2) ),
3 abc1 char(40) var,
3 abc2 char(40) var,
2 ab4 char(40) var;