×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




I'm getting more complex in my embedded SQL and am getting the following
error:

SQL0312 Variable WCUSNR not defined or not usable. 

This is not happening at compile time, but at execution time.  This is the
SQL statement:

Select c.*, i.* From NXCHNBIL C 
  Left Outer Join NXITMMST I 
  On c.ITNBR = i.ITNBR 
  Where c.ACREC = 'A' and i.NFDCD = 1 and 
    ((c.CUSNR = :wcusnr and c.CHAUT <> ' ') or 
    (c.CUSNR = :rchmst and c.CHAUT in :autsel)) 
  Order By i.MBGROP, i.MBSBGP, i.MBLINE


Debugging and a dump show the above is in variable MySQL.

I do a:

Exec SQL  Prepare Stmt1 from :MySQL;

So far I have tried 3 variables there:  1) tcusnr defined in a DS as zoned
4,0, 2) cusnr defined in a DS as packed 4,0, and now 3) wcusnr defined
standalone as packed 4,0.  All give me this same error and I do not know
why.  All show up on the dump with the expected value.

The only SWAG I have is that the host variable autsel is where the problem
actually is, but things are being reported incorrectly.  Autsel is 500 chars
long and contains:

( '@', '$', '&', '1', 'B', 'C', 'D', 'E', 'G', 'O', 'P', 'Q', 'T', 'U', 'W',
'Y' )

with a lot of blanks at the end.  But if those blanks were a problem - well
I just don't know why it would tell me wcusnr was the problem if the real
culprint was autsel.  As I said, it's just a SWAG.

Can someone tell me where to look next?  Thanks.



As an Amazon Associate we earn from qualifying purchases.

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.