Supported RPG Features

DIM(*AUTO:max) and DIM(*VAR:max) declare arrays with a maximum dimension but a current size that changes at runtime.

DCL-S Names CHAR(20) DIM(*AUTO:100);
Names(1) = 'Alice';
Names(2) = 'Bob';
DSPLY %CHAR(%ELEM(Names));       // 2  (current active count)
DSPLY %CHAR(%ELEM(Names:*MAX));  // 100 (maximum dimension)

The maximum dimension bounds the storage; %ELEM reports the current active element count.