For COBOL programs in ANSI compatible mode, defining a SQLCODE variable is required. SQLSTATE is optional.
If both variables are defined, each contains valid error codes.
SQLSTATE and SQLCODE are documented in SQL Stored Procedures and Embedded SQL (B035-1148).