SQL/MX 3.1 Programming Manual for C and COBOL (H06.23+, J06.12+)

Exception Handling and Error Conditions
HP NonStop SQL/MX Release 3.1 Programming Manual for C and COBOL663854-001
13-9
Declaring SQLCODE and SQLSTATE
The following embedded application a.sql is used to explain the behavior of the -w
option with various arguments:
#include <stdio.h>
void Func1(void);
int main()
{
long SQLCODE;
//outside declare section
EXEC SQL BEGIN DECLARE SECTION;
int SQLSTATE[6];
//inside declare section
EXEC SQL END DECLARE SECTION;
EXEC SQL INSERT INTO tt1 VALUES(10,20);
Func1();
}
Void Func1()
{
EXEC SQL INSERT INTO tt1 VALUES(11,21);17
}
The preprocessor returns the following warnings, depending upon the argument
specified for the -w option:
mxsqlc a.sql -c a.cpp -m a.mdf -w sqlcode
*** WARNING[13085] SQLCODE is not declared inside the Declare
Section.
*** WARNING[13025] Warning(s) near line 11.
*** WARNING[13085] SQLCODE is not declared inside the Declare
Section.
*** WARNING[13025] Warning(s) near line 16.
mxsqlc a.sql -c a.cpp -m a.mdf -w SQLstate
*** WARNING[13086] SQLSTATE is not declared of type char[6]
inside the Declare Section.
*** WARNING[13025] Warning(s) near line 8.
*** WARNING[13085] SQLSTATE is not declared inside the
Declare Section.
*** WARNING[13025] Warning(s) near line 16.