Association of code and data areas (z/OS and CMS)

To provide support for application program reentrancy and dynamic binding, the assembler provides a way to associate read-only code and read-write data areas. This is done by defining and accessing "associated data areas" called PSECTs. A PSECT (Private or Prototype Control Section) when instantiated becomes the non-shared working storage for an invocation of a shared reentrant program.

In the Program Object model, a PSECT is an element within the same section as the element containing the shared code to which it belongs. The two classes defining these elements will have attributes appropriate to their respective uses.

Typically, V-type and R-type address constants are used to provide code and data-area addressability for a reentrant program using PSECTs.

Figure 24 shows an example of two sections A and B, each with a PSECT. When the program object AB containing A and B is instantiated, a single copy of the reentrant CODE class is loaded into read-only storage, and a copy of the PSECT class belonging to AB is loaded into read-write storage. The invoker of A provides the address of A's PSECT so that A can address its own read-write data. A later instantiation of AB would load only a new copy of the PSECT class.

Figure 24. Program object with PSECTs, example 1
               CODE Class         PSECT Class
             *------------*     *-------------*
             |A - - -     |     | (A's PSECT) |
Section A    |            |     |             |
             |            |  *--+- DC R(B)    |
          *--+- DC V(B)   |  |  |             |
          |  |            |  |  |             |
          |  |            |  |  *-------------*
          |  *------------*  *->| (B's PSECT) |
          *->|B - - -     |     |             |
Section B    |            |     |             |
             |            |     |             |
             *------------*     *-------------*

             <------ Program Object AB ------->

When a program in the CODE class of section A calls a program in the CODE class of section B, a linkage convention might require loading the entry address of B into general register 15 and the address of B's PSECT into general register 0. For example:

         L     15,=V(B)      B's entry point address
         L     0,=R(B)       B's PSECT address (from A's PSECT)
         BASR  14,15         Linkage to B

Further information about linkage conventions for referencing Dynamic Link Libraries (DLLs) under the Language Environment can be found in z/OS Language Environment Programming Guide (SA22-7561).


[ Top of Page | Previous Page | Next Page | Contents | Index ]