MainframeSupports
tip week 4/2005:

There are many different ways to build and maintain in-storage tables in CICS. If the storage has to be shared between independent tasks running in the same CICS region the number of possibilities are more limited. The obvious one is to use a TS queue, but if speed is of the essence what it almost always is in CICS then you must GETMAIN a piece of storage and somehow communicate the address of this piece of storage to other tasks. It can be done, but it requires standards and conventions and other kind of ugly stuff.

There is a very good alternative to the GETMAIN method and that is to use a LOAD PROGRAM with the HOLD option. The good thing is that the LOAD PROGRAM returns the address of the program or in this case the storage table. The LOAD PROGRAM is a very fast CICS call according to my sources. In order to use this metod of creating a storage table, you must go through the following preparations:

  1. You must create a very simple ASSEMBLER program, which occupies the amount of storage that your storage table requires. The following program occupies 10000 bytes:

    MYSTGTBL CSECT
     DS CL10000
    END

  2. The program must be sent through an assembly and the linkage editor in order to create a LOAD-module residing on the RPL concatenation of the CICS region where the storage table should be used. If you have to send the program through a CICS precompilation then use the CICS precompilation options NOPROLOG and NOEPILOG. If you don't do this your storage table will get some code added and that was not the idea. When linkage editing the program you must use the NORENT and NCAL options. NORENT is extremely important, because it forces CICS to load the program into updateable storage. If you forget NORENT you will probably get an ASRA abend 0C4 the first time anyone tries to fill in data in the storage table.

  3. The last thing is to create a transaction that loads and initializes your storage table which I will call MYSTGTBL in this text. My LOAD-module is called MYSTGTBL and the storage table is simply created using EXEC CICS LOAD PROGRAM('MYSTGTBL') SET(MYSTGTBL-ADDRESS) HOLD. Option HOLD tells CICS to keep the storage table in memory after your initial transaction has finished. The variable MSTGTBL-ADDRESS contains the address of your storage table (the 10000 bytes large program). Now you only need to fill in some data.

Programs that wishes to access the storage table must issue an EXEC CICS LOAD PROGRAM('MYSTGTBL') SET(MYSTGTBL-ADDRESS) to obtain the address in variable MYSTGTBL-ADDRESS. And that is all there is to it. The address of the storage table is simply shared between tasks by using CICS facilities already there for us to use.

Previous tip in english        Sidste danske tip        Tip list