Declaring the SQLCA for Error Handling
You can declare the SQLCA in your application program so that the database manager can return information to your application.
About this task
When you preprocess your program, the database manager inserts host language variable declarations in place of the INCLUDE SQLCA statement. The system communicates with your program using the variables for warning flags, error codes, and diagnostic information.
Note that if SQLCODE is less than 0, it means an error has occurred and the statement has not been processed. If the SQLCODE is greater than 0, it means a warning has been issued, but the statement is still processed.
#include "sqlca.h"
extern struct sqlca sqlca;
Procedure
To declare the SQLCA, code the INCLUDE SQLCA
statement
in your program:
What to do next
If your application must be compliant with the ISO/ANS
SQL92 or FIPS 127-2 standard, do not use the statements previously
shown or the INCLUDE SQLCA
statement.