Handling an out-of-storage condition in C, C++, COBOL, or PL/I

You can use the Language Environment condition handling services to resolve an out-of-storage condition in your application. In the user-written condition handler examples that follow, CEEGTST and CEECZST are used to get and reallocate heap storage. CEEMRCR is also used to handle an out-of-storage condition in a user subroutine, and allow the subroutine to be invoked again. For the user code that corresponds to this scenario, see: in which:
  1. The out-of-storage condition arises in your subroutine, and Language Environment gives control to the user-written condition handler you have registered through CEEHDLR for the out-of-storage condition.
  2. The condition handler detects the out-of-storage condition and calls CEEMRCR to set the resume cursor to resume execution at the return address of your subroutine call.
  3. On return from the user condition handler, your main program regains control as if your subroutine has actually run.
  4. The main program tests a completion indicator and discovers that the subroutine did not actually complete.
  5. Your program then recognizes that it has been invoked with insufficient storage for maximum efficiency, and frees some previously allocated storage.
  6. The subroutine is invoked a second time and completes successfully.

See z/OS Language Environment Programming Reference for the syntax of all Language Environment condition handling services.