Defining the SQL communications area in COBOL

COBOL programs that contain SQL statements can include an SQL communications area (SQLIMSCA) to check whether an SQL statement executed successfully.

Procedure

To define the SQL communications area:

Use the following SQL INCLUDE statement to request a standard SQLIMSCA declaration:
EXEC SQLIMS INCLUDE SQLIMSCA

You can specify INCLUDE SQLIMSCA or a declaration for SQLIMSCODE wherever you can specify a 77 level or a record description entry in the WORKING-STORAGE SECTION.

IMS sets the SQLIMSCODE, SQLIMSSTATE, and SQLIMSERRMT values in the SQLIMSCA after each SQL statement executes. Your application should check these values to determine whether the last SQL statement was successful.