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.
Article ID: 323
Created: November 15, 2021
Last Updated: November 15, 2021
Author: Support KB Author
Online URL: https://support.veryant.com/phpkb/article.php?id=323