Previous Topic: Shared StorageNext Topic: Storage Pool Summary


Shared Kept Storage

Shared kept storage is available to all tasks running under the CA IDMS system. Once a storage area with the SHARED KEEP attribute is established, any task running under the CA IDMS system can access that area.

When Shared Kept Storage Is Released

CA IDMS maintains an in-use counter and a keep flag for each area of shared kept storage. Shared kept storage is released only when both of the following conditions are true:

  1. The in-use counter is set to zero, indicating that there are no current users of the area.
  2. The keep flag is turned off (the FREE STORAGE statement turns the keep flag off)

If either condition is false, the storage area remains allocated. With this feature, shared kept storage areas remain allocated even when they are not being used, provided the keep flag remains on.

Each time a task establishes addressability to an area of shared kept storage, CA IDMS adds 1 to the in-use counter. When the task terminates, CA IDMS subtracts 1 from the in-use counter. When a program issues a FREE STORAGE request, CA IDMS subtracts 1 from the in-use counter and turns off the keep flag. Once a FREE STORAGE request is issued, if the in-use counter is zero, CA IDMS releases the storage. Once turned off, the keep flag cannot be reset.

Difference from User Kept Storage

Unlike user kept storage, shared kept storage is not linked to the LTE across tasks executing on the same terminal.

Startup Shared Kept Storage

One shared storage area having the keep attribute is allocated at system startup for use by all tasks; this storage area is never freed. This area is called the common work area (CWA) and can contain application-defined information, if so requested during system generation.

For more information about the CWA, see CA IDMS System Generation Guide.

Example of Shared Kept Storage

The program excerpt below shows programmatic access to data previously placed in the CWA.

This program accesses the CWA in order to obtain the current date in Gregorian format:

 DATA DIVISION.
 01  NTCODES.
     05 NEXT-TASK           PIC X(8)   VALUE 'DEPTGET'.
 01  CWA                    PIC X(4)   VALUE 'CWA'.
 01  SOLICIT-REC.
     05 SOLICIT-DEPT-ID     PIC X(4).
     05 SOLICIT-GREG-DATE   PIC X(8).
 LINKAGE SECTION.
 01  CWA-DATA.
     05 CWA-DATE            PIC X(8).
     05 CWA-DATA-END        PIC X.

 PROCEDURE DIVISION.
     BIND MAP SOLICIT.
     BIND MAP SOLICIT RECORD SOLICIT-REC.
*** GET THE DATE IN GREGORIAN FORMAT FROM THE CWA ***
     GET STORAGE FOR CWA-DATA TO CWA-DATA-END
         NOWAIT KEEP SHORT SHARED
         STGID CWA.
     MOVE ZEROS TO SOLICIT-DEPT-ID.
     MOVE CWA-DATE TO SOLICIT-GREG-DATE.
     MAP OUT USING SOLICIT.
     DC RETURN NEXT TASK CODE NEXT-TASK.