Embedded SQL statements must appear in the PROCEDURE DIVISION of the COBOL program. Exceptions are the DECLARE and INCLUDE statements, which can appear in WORKING STORAGE or the PROCEDURE DIVISION.
In Teradata mode, the INCLUDE SQLCA statement must appear only once, in the WORKING STORAGE SECTION.
When working in ANSI compatibility mode, declare a SQLCODE variable to receive codes. Declaring a SQLSTATE variable is also valid.