×

Good News Everybody!

The new search engine is LIVE!

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




The following code will get an SQL0312 even if the code itself is ok:

...
dwqty             s                   like(qty     )
dwcustcode        S                   ike(custcode)
d clid            ds                  qualified inz
d  custcode                           like(custcode) dim(999)
d  qty                                like(qty) inz(0) dim(999)
d  n                            10i 0 inz(0)
...
w_select = 'SELECT GMCUSTCODE, SUM(GMQTY * GMSIGN) ';
...
MARCOC/exec sql
MARCOC+    FETCH CURS1 INTO :WCUSTCODE,:WQTY
MARCOC/end-exec

Qty and custcode are defined in an external ds and used as basing fields for
many other variables.

To avoid the problem I have 2 possible solutions, the first is horrible:
...
d*wqty             s                   like(qty     )
d*wcustcode        S                   ike(custcode)
dwqty             s             16  4
dwcustcode        s              6  
...

the second is adding an x (changing de facto the name):

d clid            ds                  qualified inz
d  custcodex                          like(custcode) dim(999)
d  qtyx                               like(qty) inz(0) dim(999)
d  n                            10i 0 inz(0)

I'm not sure if this is an error or the precompiler is just behaving as
documented since the manual states:

"The names of host variables must be unique within the program, even if the
host variables are in different procedures. However, if a data structure has
the QUALIFIED keyword, then the subfields of that data structure can have
the same name as a subfield in a different data structure or as a
stand-alone variable. The subfield of a data structure with the QUALIFIED
keyword must be referenced using the data structure name to qualify the
subfield name."

I honestly don't know if is the case or not to open a PMR, any opinion?

Thanks
Marco

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.