Writing routines for handling errors

You can handle most error conditions that might occur while your program is running by using the ON EXCEPTION phrase, ON SIZE ERROR phrase, or other language constructs. But if an extraordinary condition such as a machine check occurs, usually your application is abnormally terminated.

Enterprise COBOL and Language Environment® provide a way for a user-written program to gain control when such conditions occur. Using Language Environment condition handling, you can write your own error-handling routines in COBOL. They can report, analyze, or even fix up a program and enable it to resume running.

When you write your own error-handling routines for an application, the COBOL programs must be compiled with appropriate compiler options. For more information, see OPTIMIZE.

To have Language Environment pass control to a user-written error program, you must first identify and register its entry point to Language Environment. PROCEDURE-POINTER data items enable you to pass the entry address of procedure entry points to Language Environment services.

related references  
OPTIMIZE