Hi Everyone,
I have the following SQL Statement executing in a RPGIV program. Through debugging the SQL return codes, I receive the following messages once the statement executes:


SQLCOD = -305
SQLSTT = 22002

The SQLSTT error code 22002 means this: "A null value, or absence of an indicator parameter was detected; for example, the null value cannot be assigned to a host variable, because no indicator variable is specified".

Here is the datastructure I am reading the statement into:
D Hardware DS
D LnPart# 15 D LnWh 2 D LnInvType 1 D LnDesc 30 D LnQty 9 2 D LnPackSep 2 Note: It is possible for LnPackSep to get a null value, maybe this is the problem????


Here is the SQL statement:

SELECT PMP.PMPART, M3P.M3WH, ISP.ISITYP, PMP.PMDESC, WFP.WFVAL, SUM(M3P.ML3RQ) AS REQ_QTY FROM M3P, PMP, ISP, O6PWO LEFT JOIN WFP ON (WFP.WFSEGN = 'D.COLOR') AND (WFP.WFORD# = O6PWO.O6ORD#) AND (WFP.WFSUFX = O6PWO.O6SUFX) AND (WFP.WFITEM = O6PWO.O6ITEM) WHERE (M3P.M3PN=PMP.PMPART) AND (CHAR(M3P.M3ON) = O6PWO.O6WO#) AND (M3P.M3PN = ISP.ISPART) AND ((O6PWO.O6ORD# = 1023 AND O6PWO.O6SUFX=0) OR (O6PWO.O6ORD# = 1025 AND O6PWO.O6SUFX = 0)) AND ISP.ISWH = M3P.M3WH GROUP BY PMP.PMPART, M3P.M3WH, ISP.ISITYP, PMP.PMDESC, WFP.WFVAL ORDER BY M3P.M3WH, ISP.ISITYP,PMP.PMPART

The program worked fine until I added the 4 lines of SQL statement to left join the WFP file. Also the above statement works correctly using the interactive SQL utility (STRSQL). I have a feeling the problem has to do with the LnPackShp variable receiveing a null value, but I am not for sure and do not know how to correct the problem. Any help would much be appreciated.

Thanks.
Justin Houchin


This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.