× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi,

It was always documented that host variables used in embedded SQL statements
must be unique in the module.
That's because the precompiler doesn't know anything about the source code
around the SQL statements. It only checks if the host variables are defined.


Before release V5R3 uniqueness wasn't checked. With release V5R3 uniqueness
get checked and an error with level 30 returned is returned if the same
variable is defined several times.

In release V5R4 variables are also checked, but accepted if the definition
of those variables is identical.
Variables with the same definition are accepted without problems. The same
variable names with compatible data types or same data types but different
length, cause a warning or error (level 10 or 20). Only variables with the
same names but different definitions result in a severe error (level 30).

I don't know if there is a PTF for release V5R3.

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im
Auftrag von Joe D
Gesendet: Thursday, November 22, 2007 17:53
An: RPG programming on the AS400 / iSeries
Betreff: "SQL0314 - Host variable i not unique" - Am I missing something or
isthis still broken?


Hi All,

Our shop is just now jumping into procedures and service programs. One of
the things I thought would be a great help are localized variables in
procedures. Now I am seeing that localized variables do not seem to work if
the program or modules uses SQL? For example, a few of the procedures in
one of our service programs use the variable I as the counter in FOR loops.
This throws the SQL0314 error.

I did some research and it looks like this was broken in V5R3. Is it really
still unresolved? Or am I missing some special workaround we are all
supposed to be using? I did read that you can use qualified data structures
to avoid some of this, but clearly I would not want every work variable to
be declared in a data structure. And you cannot use qualified data
structure fields in SQL either.

Please let me know how you are all dealing with this. Not really supporting
local variables seems like a huge problem to me.

Thanks!
JD

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-2024 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.