Define the SQL communications area in RPG/400 applications that use SQL

The SQL precompiler automatically places the SQLCA in the input specifications of the RPG/400® program prior to the first calculation specification.

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, as defined for RPG/400:

ISQLCA       DS                                                      SQL
I*      SQL Communications area                                      SQL
I                                        1   8 SQLAID                SQL
I                                    B   9  120SQLABC                SQL
I                                    B  13  160SQLCOD                SQL
I                                    B  17  180SQLERL                SQL
I                                       19  88 SQLERM                SQL
I                                       89  96 SQLERP                SQL
I                                       97 120 SQLERR                SQL
I                                    B  97 1000SQLER1                SQL
I                                    B 101 1040SQLER2                SQL
I                                    B 105 1080SQLER3                SQL
I                                    B 109 1120SQLER4                SQL
I                                    B 113 1160SQLER5                SQL
I                                    B 117 1200SQLER6                SQL
I                                      121 131 SQLWRN                SQL
I                                      121 121 SQLWN0                SQL
I                                      122 122 SQLWN1                SQL
I                                      123 123 SQLWN2                SQL
I                                      124 124 SQLWN3                SQL
I                                      125 125 SQLWN4                SQL
I                                      126 126 SQLWN5                SQL
I                                      127 127 SQLWN6                SQL
I                                      128 128 SQLWN7                SQL
I                                      129 129 SQLWN8                SQL
I                                      130 130 SQLWN9                SQL
I                                      131 131 SQLWNA                SQL
I                                      132 136 SQLSTT                SQL
I*  End of SQLCA                                                     SQL
Note: Variable names in RPG/400 are limited to 6 characters. The standard SQLCA names have been changed to a length of 6. RPG/400 does not have a way of defining arrays in a data structure without also defining them in the extension specification. SQLERR is defined as character with SQLER1 through 6 used as the names of the elements.
Related information
SQL communication area