What happens during termination

The following sequence of events occurs during termination:

  1. C atexit() functions are invoked, if present. They are not invoked if _exit calls for termination or if abnormal termination occurs. The behavior of pthread functions are undefined if the pthread functions are called from an atexit routine.
  2. PL/I FINISH ON-units are invoked if established.
  3. For normal termination, the enclave return code is set (see Managing return codes in Language Environment). For abnormal termination caused by an unhandled condition of severity 2 or greater, either a return code and reason code or an abend is returned, based on settings specified in CEEBXITA (see Termination behavior for unhandled conditions).
  4. CEEBXITA is invoked for enclave termination after all application code has completed, but before any enclave resources are relinquished.

    You can modify CEEBXITA to request an abend and a dump. You cannot code the CEEBXITA assembler user exit as an XPLINK application. Because the environment is still active, the dump accurately reflects the state of the environment before an enclave is terminated.

  5. The environment is terminated:
    • All enclaves are terminated
    • All enclave resources are returned to the operating system
    • Any files that Language Environment manages are closed
    • Debug Tool is terminated, if active
  6. CEEBXITA is invoked for process termination after the environment is terminated. You can modify CEEBXITA to close files, request an abend, or request a dump. A dump requested at this point, however, does not have the degree of detail that one requested during enclave termination has.

    CEEBXITA is not invoked for process termination if there is an unhandled condition of severity 2 or greater, or if CEEBXITA requests an abend during enclave termination. For more information about the CEEBXITA assembler user exit, see Using runtime user exits.

Depending on the setting of the TERMTHDACT runtime option, you might receive a message, a trace of the active routines, or a dump when a condition of severity 2 or greater occurs. See z/OS Language Environment Programming Reference for more information about TERMTHDACT.