Considerations for coding and link-editing the routine

Certain considerations apply when you code and link-edit the routine.

Begin product-sensitive programming interface information.

You must consider the following items when you link-edit the routine:

  • The routine must be link-edited with the REUSE option.
  • The routine must be link-edited in 31-bit addressing mode (AMODE 31).

    The reason is that database buffer pools are allocated above the 16-MB line and the address of the segment prefix is set into a parameter list as a 31-bit address. The HDMB and HRAN control blocks are also above the 16-MB line.

    Note: If the routine does not refer to the address of any segment prefix, HDMBs, or HRANs, it can be link-edited as AMODE 24. But the 31-bit addressing mode is recommended, to avoid the addressing mode problems.

    If the routine is link-edited in 31-bit addressing mode, but performs functions requiring AMODE 24, you must code the residency mode (RMODE) as needed. Before running the function, you must use the capping method to dynamically change the addressing mode to AMODE=24; after the function has run you must return to AMODE 31. The following figure shows a sample code for such capping:

    Figure 1. Sample code for capping
    *         Change the addressing mode to AMODE 24
              DS    0H
              L     14,VCT001
              BSM   0,14
              CNOP  0,4
    VCT001    DC    AL4(*+4)
    EXT001    DS    0H
    *
              This is the functional part that requires
              24-bit addressing mode.
    *
    *         Change the addressing mode to AMODE 31
              DS    0H
              L     14,VCT002
              BSM   0,14
              CNOP  0,4
    VCT002    DC    AL4(*+4+X’80000000’)
    EXT002    DS    0H

End product-sensitive programming interface information.