Re: smallint variable returns -32768
Posted in 2003
That is the NULL value stored for smallint columns. If the application is written in ESQL/C you can use an indicator variable to detect NULL values for any returned column that might return a NULL. See the ESQL/C Programmer's Guide for details but an indicator is just a host variable declared as type 'short' (regardless of the datatype of the actual column or host variable it is indicating for) and you will need a separate indicator for each column you need to check. Then you just add the indicator to the INTO clause following the host variable it is indicating for separated by a colon (:) or the keyword 'indicator' before the following comma or semi-colon: INTO :host1, :host2 : host2_indicator, :host2.... -OR- INTO :host1, :host2 INDICATOR host2_indicator, :host2.... If the corresponding host variable has had a NULL returned to it the indicator will contain (short)-1, zero if not problem, and >0 if the host variable is a character type and the data had to be truncated to fit the host variable (in this case the indicator will contain the original string length prior to truncation). Art S. Kagel ----- Original Message ----- From: Jay Z <jay2@iafalls.com> At: 4/16 16:22 > I have a smallint variable that is returning a value of -32768 (which I assume > is the size) when it should return 0 or null. Is there anyway around this? > > Thanks for your help.