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



Dieter,

I hoped Gina Whitney would answer your question!

... but anyway:
Release 6.1 Embedded SQL Programming:
http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/index.jsp?topic=/rza
jp/rzajphostvariablesirpg.htm
Excerpt:
Using host variables in ILE RPG applications that use SQL
...
All host variables within an SQL statement must be preceded by a colon (:).
Names of host variables do not need to be unique within the program. The
precompiler recognizes variables with the same name in different procedures
and scopes them correctly.

MCPress Online:
V6R1 SQL ILE RPG Precompiler Enhancements - by Gina Whitney
... Variable Scoping
http://www.mcpressonline.com/programming/rpg/v6r1-sql-ile-rpg-precompiler-en
hancements.html

IBM Systems - Blog i Can by Dawn May
i Can?Use RPG and SQL Together
http://ibmsystemsmag.blogs.com/i_can/2010/01/i-canuse-rpg-and-sql-together.h
tml

DeveloperWorks - RPG Café
Variable Scoping Added to V5R4 SQL Precompiler
https://www.ibm.com/developerworks/mydeveloperworks/wikis/home?lang=en#/wiki
/We13116a562db_467e_bcd4_882013aec57a/page/Variable%20Scoping%20Added%20to%2
0V5R4%20SQL%20Precompiler

... Was Du empfiehlst und machst und andere tun sind immer zwei Paar
Stiefel!
(... and what you recommend and others do are two very different animals!)

... and believe me it works since aeons if the locally defined host
variables are unique within the module. (I simply added a running number to
my locally defined host variables). And with V5R4 it worked correctly if the
locally defined variables with the same name have the same definition. (...
and with PTF see above even different definitions could be used! Among other
reasons I preferred embedded SQL (over native I/O) because it was really
possible to encapsulate my file access into a procedure.

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 D*B
Gesendet: Friday, 21. October 2011 17:11
An: RPG programming on the IBM i / System i
Betreff: Re: SQLRPGLE cursor questions

@Birgitta: what the reference tells and what the SQL precompiler really
does, depends on PTF level, especially with Variables and their scope and
why should I take any risc of programms working diffrent from PTF level to
PTF level, or compiling sometimes and sometimes not.

Looking to the reference even local cursor declarations should be possible
in V7R1.

**********************************************************
But my recommendations are, keep it simple and tiny:

- use Views instead of complicated SQL statements insite programms
- one separate data access module for every View
- put your declare cursor to the top of your global C specs
- use global variables for your hostvariables in embedded SQL statements,
from the design perspective they are statefull anyway
- define all stateless variables as local variables in procedures
- if you need data from diffrent views, use the get and set procedures of
the responsable data access modules

D*B

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.