Using the IDMS CWA
search cancel

Using the IDMS CWA

book

Article ID: 29090

calendar_today

Updated On:

Products

IDMS IDMS - Database

Issue/Introduction

The CWA (common work area) is a block of shared storage available to all tasks, which exists for the life of the system. The purpose of the CWA is to facilitate communication between different tasks. A program can access the CWA by issuing a GET STORAGE request with a storage id of CWA.  The CWA is located below the line, and its size is defined by the "CWA size is" clause of the SYSTEM statement in System Generation (SYSGEN).

The following is an example of how the CWA can be viewed online and referenced by an application program.

Environment

Release: All supported releases.

Resolution

The CV in question has this definition:

*+   ADD SYSTEM 1
...
*+       CWA SIZE IS 100 

The CWA can be viewed with the command DCMT D MEM ID 'CWA'

      D MEM ID 'CWA'
<Addr>   <Offset>                 <Hex>                    <Character>
0015E000  00000000  3A7E0B80 00000080 00000000 00000000  *.=..............*
0015E010  00000010  00000000 00000000 00000000 00000000  *................*
0015E020  00000020  00000000 00000000 00000000 00000000  *................*
0015E030  00000030  00000000 00000000 00000000 00000000  *................*
0015E040  00000040  00000000 00000000 00000000 00000000  *................*
0015E050  00000050  00000000 00000000 00000000 00000000  *................*
0015E060  00000060  00000000 00000000 00000000 00000000  *................*
0015E070  00000070  00000000 00000000 00000000 3A7E0B80  *.............=..*

Note that at runtime its size is rounded up to a multiple of 128 bytes.

The following is a simple example of a cobol program which accesses the CWA.

      *RETRIEVAL
       IDENTIFICATION DIVISION.
       PROGRAM-ID.    CWASAMPL.
       ENVIRONMENT DIVISION.
       IDMS-CONTROL SECTION.
       PROTOCOL     MODE IS IDMS-DC-NONAUTO DEBUG IDMS-RECORDS MANUAL.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 WS-STORAGE-ID    PIC X(04) VALUE 'CWA '.
       COPY IDMS RECORD SUBSCHEMA-CTRL.
       LINKAGE SECTION.
       01 LS-DATA       PIC X(128).
       01 LS-DATA-END   PIC X(001).
       PROCEDURE DIVISION.
           DISPLAY 'CWASAMPL> STARTING'.
           GET STORAGE FOR LS-DATA TO LS-DATA-END
               KEEP SHARED STGID WS-STORAGE-ID LOCATION IS BELOW.
           DISPLAY 'CWASAMPL> ERROR-STATUS=' ERROR-STATUS.
           MOVE 'DONALD DUCK' TO LS-DATA.
           DISPLAY 'CWASAMPL> TERMINATING'.
           GOBACK.
       COPY IDMS IDMS-STATUS.
       IDMS-ABORT.
           EXIT.  

Execute the program with the task code CWASAMPL. Then view the contents of the CWA again:

      D MEM ID 'CWA '
 <Addr>   <Offset>                 <Hex>                    <Character>
0015E000  00000000  3A7E0B80 00000080 C4D6D5C1 D3C440C4  *.=......DONALD D*
0015E010  00000010  E4C3D240 40404040 40404040 40404040  *UCK             *
0015E020  00000020  40404040 40404040 40404040 40404040  *                *
0015E030  00000030  40404040 40404040 40404040 40404040  *                *
0015E040  00000040  40404040 40404040 40404040 40404040  *                *
0015E050  00000050  40404040 40404040 40404040 40404040  *                *
0015E060  00000060  40404040 40404040 40404040 40404040  *                *
0015E070  00000070  40404040 40404040 40404040 40404040  *                *