Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
First, when you display the SQLCODE, move it to a PIC -9(3) field first and then display that. the ?N? in the 30N includes the sign. If you look at the HEX value of ?N? you will find x?D5?, where the ?D? is the ?-? sign.
Second, you cannot assign a null value to a host variable. What you can do is assign a null indicator to a host variable.
Where HOST-COL-VAR is, well, you host variable and HOST-COL-VAR-IND is the host null indicator. It must be defined as a 9(4) COMP field. After you select, a value of 0 (zero) indicated the DB2 col value is NOT null and the host variable contains valid data, and a value of -1 indicates the DB2 value is null and the Host variable does not contain valid data (usually low-values, but not guaranteed)