Previous Topic: Executing Database ProceduresNext Topic: Methods for Invoking Procedures


Resetting the Error-Status Indicator

In resetting the error-status indicator, the procedure should change only the last two bytes (the minor code); the procedure should leave the first two bytes (the major code) unchanged. However, when the value of the error-status indicator is zero, the procedure should reset the indicator with the value from the major code item of the procedure control block.

Note: To avoid confusion, user-defined error-status codes should not duplicate CA IDMS/DB error-status codes.

At this point, if the DML command has not been canceled, the command is executed. ON-ERROR procedures are executed if errors have occurred during validation by the DBMS or if the error-status indicator contains a value other than 0000. If, because of validation errors, execution immediately drops through to an ON-ERROR procedure, BEFORE procedures and the DML command itself are not performed. The error-status indicator can be reset by either a BEFORE procedure or the DML command.

If the error-status is 00, any AFTER procedures are now executed. However, if the error-status is not 00, AFTER procedures are not executed unless at least one ON-ERROR procedure has been defined for the verb. Because AFTER procedures can be executed when the DML command has been suppressed or a non-zero error-status has been returned they should always check the values of the cancel indicator and error-status indicator.