SQL/MP Programming Manual for COBOL

Error and Status Reporting
HP NonStop SQL/MP Programming Manual for COBOL529758-003
9-4
Returning Error and Warning Information
04 TABLE-NAME PIC X(24).
04 RECORDS-ACCESSED PIC S9(9) COMP.
04 RECORDS-USED PIC S9(9) COMP.
04 DISC-READS PIC S9(9) COMP.
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:
Each SQL/MP error or warning message has an assigned code. For the codes and
their meanings, see the SQL/MP Messages Manual.
Value Status
< 0
Error
> 0
Warning
0
Successful