Determining the success of SQL statements
When Db2® finishes executing an SQL statement, Db2 sends a return code in the SQLCA structure, with one exception, to indicate whether the operation succeeded or failed. In your program, test the return code and take any necessary action.
About this task
The exception occurs when a program runs under DSN from one of the alternate entry points of the TSO batch mode module IKJEFT01 (IKJEFT1A or IKJEFT1B). In this case, the return code is passed in register 15.
After
execution of SQL statements, the content of the RETURN-CODE
special
register might not be valid. Therefore, even if your COBOL program
terminates normally after successfully using SQL statements, the job
step could end with an undefined return code. To ensure that a meaningful
return code is given at termination, set the RETURN-CODE
special
register before terminating your program.
DB2® Application Programming and SQL Guide (Coding SQL statements in a
COBOL application)