Format { WARNING } { CONTINUE } ON { ERROR } THEN { } { SEVERE_ERROR} { STOP } { }
1 – Description
The ON command specifies an action for CDO to perform when it encounters an error condition during the execution of a command procedure. The following keywords allow you to specify error conditions of increasing severity: o WARNING o ERROR o SEVERE_ERROR Error Handling if Action is CONTINUE describes error handling when you specify CONTINUE. Table 1-4 Error Handling if Action is CONTINUE Error Condition Specified Action Taken on Error WARNING Command procedure continues on warnings only; it stops for errors or severe errors. ERROR Command procedure continues on warnings and errors; it stops for severe errors only. SEVERE_ERROR Command procedure continues on warnings, errors, and severe errors. Error Handling if Action is STOP describes error handling when you specify STOP. Table 1-5 Error Handling if Action is STOP Error Condition Specified Action Taken on Error WARNING Command procedure stops on warnings, errors, or severe errors. ERROR Command procedure stops on errors or severe errors; it continues on warnings only. SEVERE_ERROR Command procedure stops on severe errors; it continues on warnings and errors. By default, errors cause CDO to stop execution if you do not specify an ON command within a command procedure. When CDO stops a command procedure, it returns you to the CDO prompt. If you nest command procedures and the ON command is executed, CDO returns you to the CDO prompt, instead of the previous command procedure.
2 – Examples
CDO> @MY_PROCEDURE SET VERIFY ON SEVERE_ERROR THEN CONTINUE DEFINE FIELD INVALID FIELD NAME DEFINE FIELD INVALID FIELD NAME ^ %CDO-E-KWSYNTAX, syntax error in command line at or near FIELD DATATYPE IS TEXT IS 7. ^ %CDO-E-KWSYNTAX, syntax error incommand line at or near DATATYPE DEFINE FIELD CORRECT_NAME_FIELD DATATYPE IS TEXT SIZE IS 7. @RECORD.CDO DEFINE RECORD VALID_RECORD. CORRECT_NAME_FIELD. END RECORD. CDO> In this example, the command procedure specifies ON SEVERE_ ERROR THEN CONTINUE. Because the command procedure encounters only an ERROR condition, it continues to execute and defines the CORRECT_NAME_FIELD field element and the VALID_RECORD record element.