At run time, your program can request DC to load a table (for example, an edit or code table) from either the DDLDCLOD area or a load (core-image) library into the program pool. This load does not imply automatic execution; your program continues to run. Typically, you use this function to place nonexecutable data in the program pool.
Making Tables Nonoverlayable
By default, tables and other programs loaded into the program pool can be overlaid when not in use or when in use and waiting for an event. However, unlike an executable module, a table is not reloaded during program execution if it has been overlaid. Therefore, you should define the table with the nonoverlayable attribute during system generation (or at run time with a DCMT VARY DYNAMIC PROGRAM command) so that it cannot be overlaid before the program deletes it.
Deleting Tables
When your program requests DC to delete a table, it does not physically delete that table; rather, it decrements the in-use counter maintained by DC. An in-use count of 0 signals DC that the space occupied by the table can be reused. When your task terminates, DC automatically deletes any tables that have not been explicitly deleted.
If your task requests a nonreentrant table more than once, DC loads a new copy of the table for each request and adds 1 to the in-use counter; each copy corresponds to a separate location in program variable storage. If your task loads the same reentrant or quasi-reentrant table more than once, it must delete that table the same number of times in order to set the in-use counter to 0.
Steps to Load and Delete a Table
To load a table into the program pool and later delete it, perform the following steps:
Note: You can qualify the name of the table by providing the DICTNAME, DICTNODE, or LOADLIB parameter on the LOAD or DELETE statement.
Illustration of Table Management
Assume that two tasks are executing under a DC system. Task 1 consists of programs A and B; task 2 consists of program D. The following diagrams illustrate how the tasks load and delete a table:
Example of Loading and Deleting a Table
The program excerpt below loads a sales tax table into the LINKAGE SECTION and computes the tax for all items in a specified order. When processing is complete, it decrements the table's in-use count by issuing a DELETE TABLE command.
PROGRAM-ID. SALESTAX. DATA DIVISION. WORKING-STORAGE SECTION. 01 SALES-TRANS-COUNT PIC S9(5) COMP-3. LINKAGE SECTION.
01 SALES-TAX-TABLE. 02 STATE-AND-TAX OCCURS 50 TIMES. 05 STATE-ABB PIC XX. 05 STATE-SALES-TAX PIC SV999. 02 SALES-TAX-TABLE-END PIC X. PROCEDURE DIVISION. . . . *** LOAD THE SALES TAX TABLE INTO THE LINKAGE SECTION *** LOAD TABLE 'SALESTAX' INTO SALES-TAX-TABLE TO SALES-TAX-TABLE-END. PERFORM A100-COMPUTE-TAX UNTIL SALES-TRANS-COUNT = 0. *** DECREMENT THE TABLE'S IN-USE COUNT *** DELETE TABLE FROM SALES-TAX-TABLE.
Copyright © 2013 CA.
All rights reserved.
|
|