There are two ways to declare the return code structure (called SQLCA):
EXEC SQL INCLUDE SQLCA
in your source program. The preprocessor replaces this with the declaration of the SQLCA structure.
Figure 124. SQLCA Structure (in FORTRAN)
INTEGER*4 SQLCOD, * SQLERR(6), * SQLTXL*2 COMMON /SQLCA1/ SQLCOD,SQLERR,SQLTXL CHARACTER SQLERP*8, * SQLWRN(0:10), * SQLTXT*70, * SQLSTT*5 COMMON /SQLCA2/ SQLERP,SQLWRN,SQLTXT,SQLSTT |
The SQLCA must not be declared within the SQL declare section. The meanings of the fields within the SQLCA are discussed in the DB2 Server for VSE & VM SQL Reference manual.
You may find that the only variable in the SQLCA you really need is SQLCODE. If this is the case, declare just the SQLCOD variable and invoke NOSQLCA support at preprocessor time.
Note: | FORTRAN requires SQLCOD instead of SQLCODE. |
The number of SQLCOD declarations is not limited by the preprocessor. If a stand-alone SQLCOD is specified, the code inserted by the preprocessor into the FORTRAN code to expand an EXEC SQL statement will refer to the address of that SQLCOD. The FORTRAN compiler determines if multiple declarations within a program section are not acceptable. In addition, the FORTRAN compiler determines which region of the code an SQLCOD declaration refers to.