Determining the success of SQL statements

When DB2 finishes executing an SQL statement, DB2 sends a return code in the SQLCODE and SQLSTATE fields of the SQLCA structure to indicate whether the operation succeeded or failed. Your program should test the return code and take any necessary action.