What should I do to this line, so SQL not gripe about missing indicator when
NULL & what will be the condition of the indicator if the result is null?
C* SELECT SUM(TQTY) INTO :ISSUES
Here's the error message I am getting:
Message . . . . : Indicator variable required.
Cause . . . . . : A FETCH, an embedded SELECT, a CALL or a SET or
VALUES
INTO statement has resulted in a null value, but an indicator variable
was
not specified for host variable ISSUES. The relative position of the
host
variable in the INTO clause or parameter list is 4. If the host
variable
name is *N, an SQLDA was
specified.
Recovery . . . : Specify an indicator variable, and precompile the
program
again.
It says this is happening at program line # 16498
16498
which happens to be a comment
documentation
Here is the code which has been running fine for years:
C*EXEC SQL
C* SELECT SUM(TQTY) INTO :ISSUES
C* FROM ITH WHERE TPROD=:IPROD
C* AND (TTYPE='CI' OR TTYPE='I')
C* AND TTDTE>=:DATLO
C* AND TTDTE<=:DATHI
C* AND TWHS>='21'
C* AND TWHS<='59'
C*END-EXEC
Here is what I added (recent archives of the data) that apparently blew up
C*EXEC SQL
C* SELECT SUM(TQTY) INTO :ISSUES
C* FROM BAKBP813/ITH WHERE TPROD=:IPROD
C* AND (TTYPE='CI' OR TTYPE='I')
C* AND TTDTE>=:DATLO
C* AND TTDTE<=:DATHI
C* AND TWHS>='21'
C* AND TWHS<='69'
C*END-EXEC
There will be cases where there is no TQTY activity where it is looking to
get a total of inventory consumed in the specified date range.
Al Macintyre
--
WOW! Homepage (
http://www.wowway.com)
As an Amazon Associate we earn from qualifying purchases.