If you reference a DataTable part in an EGL use statement, you can include the deleteAfterUse property in the statement. The property affects how long a data table remains in memory for applications generated for COBOL. The property has no effect on Java™ programs.
Specify a value of YES for the property when the table occupies a significant amount of memory, but is only used in a single program in a series of called programs in COBOL environments.
The default value of NO has the effect of keeping the table open for multiple program segments to use it.
The property affects the use count for the data table; the data table is deleted when the use count reaches zero. The use count is incremented the first time a secondary function (a function called directly by the main() function) references the data table within a program. If multiple programs reference the data table from secondary functions, the use count is incremented accordingly.
The use count is decremented according to the rules in the following table:
Value of deleteAfterUse | Is program segmented? | Use count decremented when: |
---|---|---|
NO | Yes | The main() function ends or a converse occurs |
NO | No | The main() function ends |
YES | Yes | The secondary function ends or a converse occurs |
YES | No | The secondary function ends |
Despite the apparent complexity of the rules, the effect is straightforward. If deleteAfterUse is set to YES, EGL deletes the data table as soon as no secondary function is actively using it. If deleteAfterUse is set to NO, EGL keeps the data table in memory until all programs that use the table end.
Note that the resident property of the data table takes precedence over the deleteAfterUse property of the associated use statement. If resident is set to YES, EGL keeps the data table in memory until all programs that use the table end.