Previous Topic: Minor DC Status CodesNext Topic: Logical-Record Request Control (LRC) Block


Testing for DML Error-Status Codes

Testing for the value of the ERRSTAT field in an Assembler program is a simple procedure. CA IDMS/DB places a value in the ERRSTAT field after each DML statement requesting database services is executed. This value can be compared to known error-status codes to determine whether execution was successful. For example, you can check for successful completion by comparing the ERRSTAT field to a working storage field defined as 0000. The program can then perform a conditional branch.

The following example demonstrates a test for the successful execution of the @OBTAIN statement. After completion of the @OBTAIN statement, the value returned to the ERRSTAT field is compared to the defined constant STATOK. If the @OBTAIN is successfully completed, processing continues. Otherwise, the program branches to routine OBERR2, which evaluates the ERRSTAT field and determines the next statement to be executed.

         @OBTAIN OWNER,SET='DEPT-EMPLOYEE'
         CLC   ERRSTAT,STATOK
         BNE   OBERR2
         MVC   DID,DEPTID
         .
         .
         .
STATOK   DC   CL4'0000'

In topic Data Manipulation Language Statements, the status codes that can be returned to the ERRSTAT field of the IDMS communications block are listed after the description of each database command. To determine test conditions based on error-status codes see Data Manipulation Language Statements .