DB2 Server for VSE & VM: Interactive SQL Guide and Reference


Error Mode Processing in a Routine

When an error is detected in a routine, continued processing depends on a setting you make to a special RUNMODE indicator. It indicates the mode of operation for running routines.

The format for the command that sets the indicator is:



                   .-CONTInue--.
>>-SET--RUNMode----+-----------+-------------------------------><
                   +-STOP------+
                   '-CANCEL----'
 

CONTInue
indicates that your routine continues to the next command or statement even if errors are detected. You are likely to use this option when your routine contains several independent commands or statements. Failure of a particular command or statement does not affect the remaining commands and statements.

If you do not specify a RUNMODE option, CONTINUE becomes the default value.

STOP
indicates that your routine is ended, but a ROLLBACK operation is not performed. Select this option when commands and statements within a routine are not interrelated, and you want to maintain any changes made to the database. The remaining commands and statements are not executed if errors exist in any of their predecessors.

CANCEL
indicates that your routine is ended and a ROLLBACK operation is performed. Select this option when your routine contains a series of interrelated commands and statements that update tables. When an error is detected, all changes generated by the routine are erased and the integrity of the database is maintained.

You can display the current RUNMODE setting by issuing the following command:

   list set runmode

You can set the RUNMODE indicator at any time, either from the display terminal or in a routine.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]