It seems like your main problem is this: how does the compiler know how much to allocate in the array if the size changes at runtime?
The answer is that it allocates the maximum amount of space (enough for 90 entries). Please note that this is the space for working storage. When a record is written to a file, only the corresponding part is written.
Example:
01 TABLE-SIZE PIC 9
01 TABLE OCCURS 1 TO 9 TIMES DEPENDING ON TABLE-SIZE
03 FLD1 PIC X(4)
This will contain 36 characters (9 times 4) for TABLEin working storage. If it is TABLE-SIZEset to 2, when a record is written to a file, then only 8 characters will be written TABLE(for example, over characters written for TABLE-SIZE).
, , , TABLE, AaaaBbbbCcccDdddEeeeFfffGgggHhhhIiii, , , ( ): 2AaaaBbbb.
, , TABLE-SIZE, TABLE ( ).
, TABLE -, . , , , .
TABLE-SIZE USAGE IS COMP.