DB2 6 - Evaluate SQL Commands

Evaluate SQL Commands:
  1. SQL code is DB2 supplied variable, which will contain system-defined numeric number generated by SQL statements, when they are executed.
  2. SQL code contains 00 indicates success full.
  3. SQL code contains 100 indicates Row not found (end of the table or empty table)
  4. Every SQL statement must be evaluated with IF/EVALUATE statement immediate after SQL Statement.

To use a SQl Code “SQLCA” system defined members must be copied under working (storage section by using copy member name.
 
Syntax:

WORKING STORAGE SECTION

COPY SQLCA
01    SQLCA
02 SQLCODE            PIC      S9(4) COMP.
02 SQLSTATE           PIC X(1).

EXEC SQL


Previous
Next Post »