TRY Normal Form

The normal form of the TRY statement can be used to protect any statement, including a compound statement or a procedure invocation statement. This form of the TRY statement enables multiple sets of error recovery code to be specified. If the statement following the TRY verb fails to finish normally, the statement following the first ELSE clause is executed. For an explanation of the phrase “finish normally,” see Considerations for Use later in this section.

If the statement following the first ELSE clause then fails to finish normally, the statement following the second ELSE clause is executed, if one exists. This pattern is repeated through all remaining ELSE clauses until the last one. No protection is provided if the statement following the last ELSE clause fails to finish normally. ELSE clauses are not executed if any of the preceding statements are executed successfully without fault. In the normal form of the TRY statement, another normal-form TRY statement cannot be used as the <statement> portion unless it is part of a block statement or compound statement.