3. Embedded SQL for COBOL : The SQL Communications Area : SQLSTATE Variable Usage
 
Share this page                  
SQLSTATE Variable Usage
You can use the SQLSTATE variable in an ESQL/COBOL program to return status information about the last SQL statement that was executed. SQLSTATE must be declared in a DECLARE SECTION and its declaration must be valid for the entire file being preprocessed.
To declare this variable, use:
01 SQLSTATE     PICTURE X(5).
or :
77 SQLSTATE     PICTURE X(5).