Previous Topic: How to Handle SQL Error CodesNext Topic: Display All the Fields in the SQLCA


Display the SQLCODE

Once your program halts at a breakpoint, the Keep window displays the hexadecimal contents of SQLCODE. To display the SQL return code in decimal format, follow these steps:

  1. Type D to the left of SQLCODE in the Keep window.
  2. Press Enter.

If you have not kept SQLCODE in the Keep window, follow these steps:

  1. Type D to the left of the statement where you are stopped.
  2. Position the cursor under the data field SQLCODE.
  3. Press Enter.

CA InterTest for CICS displays a CORE structured display of SQLCODE and the following message:

CORE053 VALUE OF FIELD is = +/‑ nnn
nnn

Indicates the SQL return code.

DB2 return codes can have many meanings and subcodes. The DB2 Messages and Codes manual explains the return codes.

You can convert this value into a text message by overkeying the CORE='SQLCODE' command at the bottom of the SQLCODE display with the following command and pressing Enter:

CORE=SQLRCODE

You can access the SQLCODE text message display from the breakpoint screen by entering CORE=SQLRCODE on the command line, if the command line displays.

CA InterTest for CICS converts the decimal value to a text message. In addition, if there are any warning codes in the SQLCA, CA InterTest for CICS displays each of them along with its meaning. The following is a sample SQLRCODE display.

CA InterTest for CICS V9.1 - MAIN STORAGE UTILITY  Termid = LXD6         DSNT408I SQLCODE = 204              ERROR:  ADM.DEPT IS AN UNDEFINED NAME                               -------------------------------------------------------------------------        PFKEYS 1 Help     2           3 End       4 Return      5            6                 7          8           9          10            11           12    CORE=SQLRCODE

DB2 messages often contain tokens that are replaced at execution time. The message in the previous example the token name is replaced by the actual name that is undefined—in this case, ADM.DEPT.

Without CA InterTest for CICS, tokens are often hard to interpret. They are returned in the SQLERRM field of the SQLCA, and if there are multiple tokens, appear sequentially in the order in which they appear in the message text, separated by X'FF'. CA InterTest for CICS inserts tokens in the correct places in the message text, as shown in the previous figure, which makes the DB2 messages much easier to understand.