Ja, das stimmt schon, es ist teilweise relativ schwer spezielle Informationen zu finden.
Ich habe damals, als ich für meine DB Workshops, das Programm zusammen gestellt habe, die ganzen DB Redbooks !komplett! gelesen.

Redbook: "SQL Procedures, Triggers, andFunctions on IBM DB2 for i"
Kapitel: 2.6.6 Direct SQLSTATE and SQLCODE usage
Sometimes, it is handy to use the SQLSTATE or SQLCODE directly. Although error handlingis provided by the conditions, handlers and GET DIAGNOSTICS in PSM mostly preclude theneed for direct usage. However, direct usage can facilitate efficiencies sometimes in writingcode.

To access these values in an SQL procedure, you must first define them as variables with theexact names, as shown in Example 2-42.

Example 2-42 Declaring SQLCODE and SQLSTATE
DECLARE SQLCODE INTEGER DEFAULT 0;
DECLARE SQLSTATE CHAR(5) DEFAULT '00000';