SQL/MP Programming Manual for COBOL85
Error and Status Reporting
HP NonStop SQL/MP Programming Manual for COBOL85—429326-004
9-4
Returning Error and Warning Information
04 MESSAGES PIC S9(9) COMP.
04 MESSAGE-BYTES PIC S9(9) COMP.
04 WAITS PIC S9(4) COMP.
04 ESCALATIONS PIC S9(4) COMP.
04 SQLSA-RESERVED PIC X(4).
02 PREPARE REDEFINES DML.
03 INPUT-NUM PIC 9(4) COMP.
03 INPUT-NAMES-LEN PIC 9(4) COMP.
03 OUTPUT-NUM PIC 9(4) COMP.
03 OUTPUT-NAMES-LEN PIC 9(4) COMP.
03 NAME-MAP-LEN PIC 9(4) COMP.
03 SQL-STATEMENT-TYPE PIC 9(4) COMP.
88 SQL-STATEMENT-SELECT VALUE 1.
88 SQL-STATEMENT-INSERT VALUE 2.
88 SQL-STATEMENT-UPDATE VALUE 3.
88 SQL-STATEMENT-DELETE VALUE 4.
88 SQL-STATEMENT-DDL VALUE 5.
88 SQL-STATEMENT-CONTROL VALUE 6.
88 SQL-STATEMENT-DCL VALUE 7.
Returning Error and Warning Information
SQL/MP provides these methods you can use to check for and process errors and
warnings in your program:
•
Checking the SQLCODE (or SQLCODEX) data item
•
Using the WHENEVER directive
•
Using constraints to check for errors
•
Checking information from the SQLCA structure
Checking the SQLCODE Identifier
SQL/MP returns an error or warning code to SQLCODE after the execution of each
embedded SQL statement or directive as follows:
Each SQL/MP error or warning message has an assigned code. For the codes and
their meanings, see the SQL/MP Messages Manual.
Using the SQLCODE Data Item
The COBOL85 compiler does not automatically generate an SQLCA structure, which
includes the SQLCODE data item. You must declare an SQLCODE identifier either
explicitly as a PIC S9(4) COMP data item or implicitly with an INCLUDE SQLCA
directive. You cannot specify SQLCODE both explicitly as a data item and implicitly
with an INCLUDE SQLCA directive.
Value Status
< 0
Error
> 0
Warning
0
Successful