Nonstop Database, HiRDB Version 9 UAP Development Guide
The SQL Communications Area need not be described in the UAP, because it is expanded by the SQL preprocessor in the source program written in a high-level language.
The format of the SQL Communications Area expanded by the SQL preprocessor in a source program is shown as follows.
This example shows SQL Communications Area expansion when C language is used.
#define SQLCAIDE sqlca.sqlcaide #define SQLCODE sqlca.sqlcode #define SQLERRML sqlca.sqlerrml #define SQLERRMC sqlca.sqlerrmc #define SQLERRMD sqlca.sqlerrmd #define SQLERRD0 sqlca.sqlerrd[0] #define SQLERRD1 sqlca.sqlerrd[1] #define SQLERRD2 sqlca.sqlerrd[2] #define SQLERRD3 sqlca.sqlerrd[3] #define SQLERRD4 sqlca.sqlerrd[4] #define SQLERRD5 sqlca.sqlerrd[5] #define SQLWARN0 sqlca.sqlwarn0 #define SQLWARN1 sqlca.sqlwarn1 #define SQLWARN2 sqlca.sqlwarn2 #define SQLWARN3 sqlca.sqlwarn3 #define SQLWARN4 sqlca.sqlwarn4 #define SQLWARN5 sqlca.sqlwarn5 #define SQLWARN6 sqlca.sqlwarn6 #define SQLWARN7 sqlca.sqlwarn7 #define SQLWARN8 sqlca.sqlwarn8 #define SQLWARN9 sqlca.sqlwarn9 #define SQLWARNA sqlca.sqlwarna #define SQLWARNB sqlca.sqlwarnb #define SQLWARNC sqlca.sqlwarnc #define SQLWARND sqlca.sqlwarnd #define SQLWARNE sqlca.sqlwarne #define SQLWARNF sqlca.sqlwarnf typedef struct sqlca { char sqlcaidc[5]; /* Table ID */ char sqlcaids[2]; /* Used by HiRDB */ char sqlcaide; /* Used by HiRDB */ long sqlcabc; /* SQLCA area length */ long sqlcode; /* SQLCODE */ short sqlerrml; /* Effective message length */ char sqlerrmc[254]; /* Message text */ char sqlerrp[8]; /* Used by HiRDB */ long sqlerrd[6]; /* HiRDB internal status */ char sqlwarn0; /* Warning information flag */ char sqlwarn1; /* Warning information 1 */ char sqlwarn2; /* Warning information 2 */ char sqlwarn3; /* Warning information 3 */ char sqlwarn4; /* Warning information 4 */ char sqlwarn5; /* Warning information 5 */ char sqlwarn6; /* Warning information 6 */ char sqlwarn7; /* Warning information 7 */ char sqlwarn8; /* Warning information 8 */ char sqlwarn9; /* Warning information 9 */ char sqlwarna; /* Warning information 10 */ char sqlwarnb; /* Warning information 11 */ char sqlwarnc; /* Warning information 12 */ char sqlwarnd; /* Warning information 13 (reserved) */ char sqlwarne; /* Warning information 14 (reserved) */ char sqlwarnf; /* Warning information 15 (reserved) */ char sqlcasys1[16]; /* Reserved */ }SQLCA; extern SQLCA sqlca;
The next example shows SQL Communications Area expansion when COBOL is used.
01 SQLCA IS EXTERNAL. 02 SQLCAID PIC X(8). 02 FILLER REDEFINES SQLCAID. 03 SQLCAIDC PIC X(5). 03 SQLCAIDS PIC X(2). 03 SQLCAIDE PIC X(1). 02 SQLCABC PIC S9(9) COMP. 02 SQLCODE PIC S9(9) COMP. 02 SQLERRM. 03 SQLERRML PIC S9(4) COMP. 03 SQLERRMC PIC X(254). 02 SQLERRP PIC X(8). 02 SQLERRD PIC S9(9) COMP OCCURS 6 TIMES. 02 SQLWARN. 03 SQLWARN0 PIC X. 03 SQLWARN1 PIC X. 03 SQLWARN2 PIC X. 03 SQLWARN3 PIC X. 03 SQLWARN4 PIC X. 03 SQLWARN5 PIC X. 03 SQLWARN6 PIC X. 03 SQLWARN7 PIC X. 02 SQLEXT. 03 SQLWARN8 PIC X. 03 SQLWARN9 PIC X. 03 SQLWARNA PIC X. 03 SQLWARNB PIC X. 03 SQLWARNC PIC X. 03 SQLWARND PIC X. 03 SQLWARNE PIC X. 03 SQLWARNF PIC X. 02 SQLCASYS1 PIC X(16).
All Rights Reserved. Copyright (C) 2011, Hitachi, Ltd.