In C and C++, INCLUDE SQLCA declarations are equivalent to the following:
#ifndef SQLCODE struct sqlca { unsigned char sqlcaid[8]; long sqlcabc; long sqlcode; short sqlerrml; unsigned char sqlerrmc[70]; unsigned char sqlerrp[8]; long sqlerrd[6]; unsigned char sqlwarn[11]; unsigned char sqlstate[5]; }; #define SQLCODE sqlca.sqlcode #define SQLWARN0 sqlca.sqlwarn[0] #define SQLWARN1 sqlca.sqlwarn[1] #define SQLWARN2 sqlca.sqlwarn[2] #define SQLWARN3 sqlca.sqlwarn[3] #define SQLWARN4 sqlca.sqlwarn[4] #define SQLWARN5 sqlca.sqlwarn[5] #define SQLWARN6 sqlca.sqlwarn[6] #define SQLWARN7 sqlca.sqlwarn[7] #define SQLWARN8 sqlca.sqlwarn[8] #define SQLWARN9 sqlca.sqlwarn[9] #define SQLWARNA sqlca.sqlwarn[10] #define SQLSTATE sqlca.sqlstate #endif struct sqlca sqlca;
In COBOL, INCLUDE SQLCA declarations are equivalent to the following:
01 SQLCA. 05 SQLCAID PIC X(8). 05 SQLCABC PIC S9(9) BINARY. 05 SQLCODE PIC S9(9) BINARY. 05 SQLERRM. 49 SQLERRML PIC S9(4) BINARY. 49 SQLERRMC PIC X(70). 05 SQLERRP PIC X(8). 05 SQLERRD OCCURS 6 TIMES PIC S9(9) BINARY. 05 SQLWARN. 10 SQLWARN0 PIC X(1). 10 SQLWARN1 PIC X(1). 10 SQLWARN2 PIC X(1). 10 SQLWARN3 PIC X(1). 10 SQLWARN4 PIC X(1). 10 SQLWARN5 PIC X(1). 10 SQLWARN6 PIC X(1). 10 SQLWARN7 PIC X(1). 10 SQLWARN8 PIC X(1). 10 SQLWARN9 PIC X(1). 10 SQLWARNA PIC X(1). 05 SQLSTATE PIC X(5).
In FORTRAN, INCLUDE SQLCA declarations are equivalent to the following:
CHARACTER SQLCA(136) CHARACTER SQLCAID*8 INTEGER*4 SQLCABC INTEGER*4 SQLCODE INTEGER*2 SQLERRML CHARACTER SQLERRMC*70 CHARACTER SQLERRP*8 INTEGER*4 SQLERRD(6) CHARACTER SQLWARN*11 CHARACTER SQLSTOTE*5 EQUIVALENCE (SQLCA( 1), SQLCAID) EQUIVALENCE (SQLCA( 9), SQLCABC) EQUIVALENCE (SQLCA( 13), SQLCODE) EQUIVALENCE (SQLCA( 17), SQLERRML) EQUIVALENCE (SQLCA( 19), SQLERRMC) EQUIVALENCE (SQLCA( 89), SQLERRP) EQUIVALENCE (SQLCA( 97), SQLERRD) EQUIVALENCE (SQLCA(121), SQLWARN) EQUIVALENCE (SQLCA(132), SQLSTOTE) INTEGER*4 SQLCOD, C SQLERR(6) INTEGER*2 SQLTXL CHARACTER SQLERP*8, C SQLWRN(0:7)*1, C SQLWRX(1:3)*1, C SQLTXT*70, C SQLSTT*5, C SQLWRNWK*8, C SQLWRXWK*3, C SQLERRWK*24, C SQLERRDWK*24 EQUIVALENCE (SQLWRN(1), SQLWRNWK) EQUIVALENCE (SQLWRX(1), SQLWRXWK) EQUIVALENCE (SQLCA(97), SQLERRDWK) EQUIVALENCE (SQLERR(1), SQLERRWK) COMMON /SQLCA1/SQLCOD,SQLERR,SQLTXL COMMON /SQLCA2/SQLERP,SQLWRN,SQLTXT,SQLWRX,SQLSTT
In PL/I; INCLUDE SQLCA declarations are equivalent to the following:
DCL 1 SQLCA, 2 SQLCAID CHAR(8), 2 SQLCABC BIN FIXED(31), 2 SQLCODE BIN FIXED(31), 2 SQLERRM CHAR(70) VAR, 2 SQLERRP CHAR(8), 2 SQLERRD(6) BIN FIXED(31), 2 SQLWARN, 3 SQLWARN0 CHAR(1), 3 SQLWARN1 CHAR(1), 3 SQLWARN2 CHAR(1), 3 SQLWARN3 CHAR(1), 3 SQLWARN4 CHAR(1), 3 SQLWARN5 CHAR(1), 3 SQLWARN6 CHAR(1), 3 SQLWARN7 CHAR(1), 3 SQLWARN8 CHAR(1), 3 SQLWARN9 CHAR(1), 3 SQLWARNA CHAR(1), 2 SQLSTATE CHAR(5);
In RPG/400®; SQLCA declarations are equivalent to the following:
ISQLCA DS 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
In ILE RPG; SQLCA declarations are equivalent to the following:
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