When to avoid using dynamic allocation

Do not use dynamic allocation in the following types of programs, because their characteristics, combined with a dynamic allocation request, can cause the program to end abnormally:
  • Programs running in cross memory mode.

    For further information on the use of cross memory services, see z/OS MVS Programming: Extended Addressability Guide.

  • Programs running under an interruption request block (IRB).

    Requesting dynamic allocation functions in routines that run under an IRB and issue OPEN, OPENJ, CLOSE, EOV, or FEOV, or any other service that enqueues on SYSZTIOT can cause a X'138' abend.

  • Installation exits that get control during the start of the job entry subsystem.
  • Installation exits that get control before batch allocation is complete.
  • User exits for OPEN/CLOSE/EOV, or for any other routines that enqueue on SYSZTIOT.
  • Multitasking programs in which one task issues the DYNALLOC macro with the S99TIONQ bit on in S99FLAG2, and other tasks issue the DYNALLOC, OPEN, OPENJ, CLOSE, EOV, FEOV, or LOCATE macros.
  • MVS™ command installation exits.

    For further information about this restriction and about command installation exits, see z/OS MVS Installation Exits.

Additional requirements and restrictions for dynamic allocation are outlined in Programming considerations for using the DYNALLOC macro.