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



Thanks for the compliments

Mit freundlichen Gru?en / Best regards

Birgitta

"Shoot for the moon, even if you miss, you'll land among the stars." 
(Les Brown) 

-----Ursprungliche Nachricht-----
Von: rpg400-l-bounces+hauser=sss-software.de@xxxxxxxxxxxx
[mailto:rpg400-l-bounces+hauser=sss-software.de@xxxxxxxxxxxx]Im Auftrag
von Jeff Crosby
Gesendet: Dienstag, 18. Juli 2006 13:16
An: 'RPG programming on the AS400 / iSeries'
Betreff: RE: SQL Alias within RPG


Thanks for replying.  You must really know your SQL as you respond to
virtually all SQL questions here.  That's really helpful to those of us
getting our feet wet.

you definitely have to use dynamic SQL.

<snip>
 
Here an example:

/Free
   CmdString = 'CREATE ALIAS MYALIAS FOR MYTABLE (' + 
%Trim(MyMember) + ')';
   Exec SQL  Execute Immediate :CmdString; /End-Free

Thanks for the examples.  I'm going to do some experimenting today.

BTW I wouldn't create an alias at runtime. Aliases are 
permanent objects
(DDM-Files) that can be created once and used when ever 
needed. If the members you have to read change every day, I'd 
suggest to use the CL-Command OVRDBF to override the member 
and use it in the SQL statments

I understand it's permanent.  Normally when I require a specific member in
RPG, an OVRDBF in CL is what I do.  What I was planning to do in RPG was 1)
create the alias, 2) use it, and then 3) delete it.  It's used once a month
(not daily) for this report and that's it.  Next month a different member
will be used.  My reasoning for wanting to do it this way was that
everything (including the 'override') would be contained within this RPG
program.  Your suggestion is when I need a specific member in SQL RPG is to
break down and use OVRDBF just like 'regular' RPG, right?

Thanks again. 


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.