SQL/MP Programming Manual for COBOL
Error and Status Reporting
HP NonStop SQL/MP Programming Manual for COBOL—529758-003
9-19
Returning Information From the SQLCA
Each Monday, for example, you could use DUP to copy TABLEX to a TABLEX1, and 
then clear TABLEX before activating the Pathway system. The errors found this week 
and last week are available. Only a minimum amount of program code is needed to 
support this facility. 
Selective Error Reporting
SQL/MP returns an error condition for many different errors. Some of these are true 
errors, others are not. For example, -8227 indicates the user is trying to insert a 
duplicate row (a mistake), and -8300 indicates a file-system error (a true error).
Both conditions cause the WHENEVER SQLERROR procedure to be executed. You 
could assume that the first condition should be reported only to the terminal as a 
mistake, whereas the second condition should be reported as an error to database 
administration.
Mistakes can also be considered as anticipated errors because the program can 
anticipate them. A record not found or an end-of-file condition, like the duplicate record 
condition, are errors that can be anticipated and reported to the terminal, not logged to 
an error table.
Here are some other examples of anticipated errors:
You could examine all the SQL error codes and decide which should be reported as 
true errors and which should be reported to a terminal as anticipated errors. This task 
is not recommended because the number of errors is large. Also, the application 
requirements might vary. For example, it might depend on your application 
requirements whether you consider timeout errors to be anticipated errors or true 
errors to be reported to a log file.
You can develop a common routine to test such conditions and to react accordingly. If 
you develop such a common routine, consider having two such routines: one to use for 
testing and one for production.
Many errors are programming errors, such as 8225 and 8226, which are cursor 
declaration errors. Other errors are run-time errors. To facilitate testing, reply to the 
terminal when anticipated errors are found during development and also log them as 
errors. Use this strategy to determine which SQL statements failed and why.
When you go to production, you no longer want to log the anticipated errors. As a 
result, the number of errors logged during production is less than the total number 
logged during development. The production routine should check for anticipated errors 
and reply to the terminal only.
Error Number Description
4028 Value for column x has an incompatible data type. 
8230 Zero rows returned by subquery. 
8233 Constraint number x violated (possibly a special situation). 
8405 Decimal data encountered with some nonnumeric digits.










