3. Embedded SQL for COBOL : The SQL Communications Area : The Include SQLCA Statement
 
Share this page                  
The Include SQLCA Statement
You should issue the include sqlca statement in the Working-Storage Section of the Data Division of your COBOL program. For example:
DATA DIVISION.
WORKING-STORAGE SECTION.

EXEC SQL INCLUDE SQLCA END-EXEC.
EXEC SQL BEGIN DECLARE SECTION END-EXEC.
    * declarations

EXEC SQL END DECLARE SECTION END-EXEC.
If you have multiple programs in a run unit, you must issue the include sqlca statement in each program.
The include sqlca statement instructs the preprocessor to generate code to call Ingres runtime libraries. It generates a COBOL COPY directive to make all the generated calls acceptable to the compiler.
Whether or not you intend to use the SQLCA for error handling, you must issue an include sqlca statement. If you do not issue it, the COBOL compiler will generate errors about undeclared data items in CALL statements.