When an SQL statement is processed in your program, SQL places a return code in the SQLCODE and SQLSTATE fields. The return codes indicate the success or failure of the running of your statement.
The main purpose for SQLSTATE is to provide common return codes for common return conditions among the different IBM® relational database systems. SQLSTATEs are particularly useful when handling problems with distributed database operations.
Because the SQLCA is a valuable problem-diagnosis tool, it is a good idea to include in your application programs the instructions necessary to display some of the information contained in the SQLCA. Especially important are the following SQLCA fields: