wSql2 is just a string, you can't use hostvars in it. You could use substitution variables ('?') and then the PREPARE... USING...


As for the override, that's certainly one way. For another have a look at CREATE ALIAS.



David FOXWELL wrote:
Hi everyone,

I have replaced this :

wSql2 =

'SELECT COUNT(*), SUM(MyField) ' +

'INTO : RPGfield2, : RPGfield2 ' +

'FROM MyFile' +

' WHERE SUBSTR(DAENRE, 22, 3) = ''210''';

EXEC SQL

PREPARE S3 FROM : wSql2;





with this :

EXEC SQL

SELECT COUNT(*),SUM(MyField)

INTO : RPGfield2, : RPGfield2

FROM MyFile

WHERE SUBSTR(DAENRE, 22, 3) = '210';


In the first case, I was getting SQL0312 at the PREPARE. Is it because of the host variables? The second case works fine. MyFile was also supposed to be in a host variable as its name is composed with the year.
I will probably override its name in a CL.

I'd be grateful if anyone can explain why the first case is not possible and how it should be done.

TIA.


This thread ...

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.