Steps for finding the static storage area

If you have C code compiled with the NORENT option (hereafter called NORENT code) you must determine the base address of the static storage area if you want to calculate the address of a static or external variable.

Perform the following steps to find the static storage area:

  1. Name the static storage area CSECT by using the pragma csect directive. Once this is done, a CSECT is generated for the static storage area for each source file.
  2. Determine the origin and length of the CSECT from the linker map.
  3. Locate the external variables corresponding to the CSECT with the same name.
  4. Determine the origin and length of the external variable CSECT from the linker map.
Note:
  1. Address calculation for static and external variables uses the static storage area as a base address with 1 or more offsets added to this address.
  2. The storage associated with these CSECTs is not dumped when an exception occurs. It is dumped when cdump or CEE3DMP is called, but it is written to a separate ddname called CEESNAP. For information about cdump, CEE3DMP, and enabling the CEESNAP ddname, see Generating a Language Environment dump of a C/C++ routine.