The SQL precompiler automatically places the SQLCA in the definition specifications of the ILE RPG program prior to the first calculation specification, unless a SET OPTION SQLCA = *NO statement is found.
INCLUDE SQLCA should not be coded in the source program. If the source program specifies INCLUDE SQLCA, the statement will be accepted, but it is redundant. The SQLCA source statements for ILE RPG are:
D* SQL Communications area D SQLCA DS D SQLCAID 8A INZ(X'0000000000000000') D SQLAID 8A OVERLAY(SQLCAID) D SQLCABC 10I 0 D SQLABC 9B 0 OVERLAY(SQLCABC) D SQLCODE 10I 0 D SQLCOD 9B 0 OVERLAY(SQLCODE) D SQLERRML 5I 0 D SQLERL 4B 0 OVERLAY(SQLERRML) D SQLERRMC 70A D SQLERM 70A OVERLAY(SQLERRMC) D SQLERRP 8A D SQLERP 8A OVERLAY(SQLERRP) D SQLERR 24A D SQLER1 9B 0 OVERLAY(SQLERR:*NEXT) D SQLER2 9B 0 OVERLAY(SQLERR:*NEXT) D SQLER3 9B 0 OVERLAY(SQLERR:*NEXT) D SQLER4 9B 0 OVERLAY(SQLERR:*NEXT) D SQLER5 9B 0 OVERLAY(SQLERR:*NEXT) D SQLER6 9B 0 OVERLAY(SQLERR:*NEXT) D SQLERRD 10I 0 DIM(6) OVERLAY(SQLERR) D SQLWRN 11A D SQLWN0 1A OVERLAY(SQLWRN:*NEXT) D SQLWN1 1A OVERLAY(SQLWRN:*NEXT) D SQLWN2 1A OVERLAY(SQLWRN:*NEXT) D SQLWN3 1A OVERLAY(SQLWRN:*NEXT) D SQLWN4 1A OVERLAY(SQLWRN:*NEXT) D SQLWN5 1A OVERLAY(SQLWRN:*NEXT) D SQLWN6 1A OVERLAY(SQLWRN:*NEXT) D SQLWN7 1A OVERLAY(SQLWRN:*NEXT) D SQLWN8 1A OVERLAY(SQLWRN:*NEXT) D SQLWN9 1A OVERLAY(SQLWRN:*NEXT) D SQLWNA 1A OVERLAY(SQLWRN:*NEXT) D SQLWARN 1A DIM(11) OVERLAY(SQLWRN) D SQLSTATE 5A D SQLSTT 5A OVERLAY(SQLSTATE) D* End of SQLCA
If a SET OPTION SQLCA = *NO statement is found, the SQL precompiler automatically places SQLCODE and SQLSTATE variables in the definition specification. They are defined as follows when the SQLCA is not included:
D SQLCODE S 10I 0 D SQLSTATE S 5A