SQL/MX 3.2 Programming Manual for C and COBOL (H06.25+, J06.14+)

Exception Handling and Error Conditions
HP NonStop SQL/MX Release 3.2 Programming Manual for C and COBOL663854-002
13-6
Declaring SQLCODE and SQLSTATE
Both
If the SQLCODE or SQLSTATE is missing or incorrect, the following behavior is
observed:
If SQLCODE or SQLSTATE is missing or incorrect, the preprocessor will issue a
warning for SQLCODE, SQLSTATE, or both depending on the argument for the -w
option.
If the SQLCODE or SQLSTATE is missing in a scope, warning 13085 will be issued
when the first embedded SQL statement within the scope is encountered.
If the SQLCODE or SQLSTATE is declared incorrectly within the Declare section,
warning 13086 will be issued at the end of the SQL Declare section.
If the -w option is not specified, the default behavior is expected.
For information on how to use the -w option, see Syntax for the OSS-Hosted SQL/MX
C/C++ Preprocessor on page 15-20 and Syntax for the Windows-Hosted SQL/MX
C/C++ Preprocessor on page 15-28.
Table 13-3 describes the behavior of preprocessor, embedded application, and
language compiler for SQLCODE and SQLSTATE with different scopes. It is assumed
that SQLSTATE and SQLCODE are declared correctly and are used to handle
exception conditions.
Table 13-3. SQLCODE and SQLSTATE missing declaration
SQLCOD
E
SQLSTA
TE
Values of -w command line
option for the preprocessor
Language
Compiler
Values returned to
the application default
sqlcode sqlstate Both
SQLCO
DE
SQLSTA
TE
IN IN
No
warning
No
warning
No
warning
No Error Yes Yes
No
Warning
IN
OUT No
warning
Warning
for
SQLST
ATE
Warning
for
SQLST
ATE
No Error Yes No No
Warning
IN ND No
warning
Warning
for
SQLST
ATE
Warning
for
SQLST
ATE
Error for
SQLSTAT
E
Yes No No
Warning
OUT
IN
Warning
for
SQLCO
DE
No
warning
Warning
for
SQLCO
DE
No Error No
Yes
No
Warning
OUT OUT Warning
for
SQLCOD
E
Warning
for
SQLSTA
TE
Warning
for both
No Error Yes No No
Warning