Question ID : 323
Created on 2021-11-15 at 7:51 AM
Author : Veryant Support [support@veryant.com]
Online URL : http://support.veryant.com/support/phpkb/question.php?ID=323
Every COBOL application has many programs containing definitions with OCCURS in Working Storage or Linkage sections.
These arrays are usually of a fixed size to accommodate the maximum number of references possible in the table.
The result is that the memory consumed for the array is fixed, even when the program doesn't need to use all the occurrences.
For example, this definition:
78 max-element value 900. 01 w-group. 03 w-element occurs max-element. 05 w-cod pic 9(3). 05 w-desc pic x(20). 05 w-note pic x(100).will allocate the memory for all 900 occurrences at the program startup, even if the program will use only few references.
01 w-group. 03 w-element dynamic capacity max-element. 05 w-cod pic 9(3). 05 w-desc pic x(20). 05 w-note pic x(100).The existing code works without any change, so statements like MOVE, IF, SORT... are still supported.