HLASM Language Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


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

HLASM Language Reference
SC26-4940-06

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 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 1 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 for the PSECT of A, so that A can address its own read-write data. A later instantiation of AB loads only a new copy of the PSECT class.
Figure 1. 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).

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014