Asterisk notation
In an ALLOCATE statement, values are inherited from the most recent previous generation when dimensions, lengths, or sizes are indicated by asterisks. For arrays, the asterisk must be used for every dimension of the array, not just one of them.
Consider the following example:
dcl X(M,N) char(A) ctl;
M=10;
N=20;
A=5;
allocate X;
allocate X(10,10);
allocate X(*,*);
The first generation of X has bounds (10,20);
the second and third generations have bounds (10,10). The elements
of each generation of X are all character strings
of length 5.
The asterisk notation can also be used in a DECLARE statement, but has a different meaning there. Consider the following example:
dcl Y char(*) ctl,
N fixed bin;
N=20;
allocate Y char(N);
allocate Y;
The length of the character string Y is taken
from the previous generation unless it is specified in an ALLOCATE
statement. In that case, Y is given the specified
length. This allows you to defer the specification of the string length
until the actual allocation of storage.