Considerations for Use

The phrase “finish normally,” in the previous explanations, means completion of the statement or procedure without run-time errors, faults, or conditions that could cause a process to be terminated. These conditions include, but are not limited to, faults such as divide by zero, invalid index, stack overflow, task attribute errors, security violations, untrapped I/O errors, and termination causes such as programmatic termination. These conditions include only those exception conditions that would result in program termination.

Some termination causes ignore all TRY occurrences that are invoked after a specified point in the execution history of a process. These causes include stack overflow and library delink errors. For example, if a process has invoked an imported library procedure that has not yet exited when a library delink error occurs, any TRY verbs that occurred after the procedure invocation are ignored. If a stack overflow occurs, TRY occurrences are ignored unless they are sufficiently far down the stack that the stack can be cut back to the TRY statement and still be at a safe size.

If TRY is used in the same process as ON statements, whichever one is closest to the exception point and capable of handling the condition is used.

If TRY is used in a block that declares an EXCEPTION procedure, the EXCEPTION procedure is invoked only if the TRY does not handle the condition.

A program dump can be generated if the OPTION task attribute has the FAULT option selected, even if the fault is handled by the TRY statement. Messages associated with the fault are suppressed if the fault could have been handled by the ON statement.

Using a GO TO statement to branch out of a TRY statement disables the TRY statement. If an EPILOG procedure is called during the processing of the GO TO statement, any faults within that EPILOG procedure are not caught by the TRY statement.