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



On 02 Nov 2012 15:54, Darryl Freinkel wrote:
I have not used this in a while and need to be able to create a SQL
alias on the fly.

I have a RPG SQL program that reads a file which contains the
library, file and member which I need to use and create a SQL ALIAS
with so that I can read this file.

Can someone help with how to do this in RPG?


If the information is known before the SQL [RPG or otherwise], an OVRDBF request is much "lighter" than the "heavier" CREATE ALIAS; i.e. the former is merely an entry added to an [effective] index that will already exist for every job whereas the latter creates an external object and a similar [effective] index entry for SQL tracking for QTEMP or an entry as a database row for the catalog entry if not in QTEMP.

Because the SQL ALIAS is implemented as a permanent object [irrespective of library], the request is /expensive/ when utilized in an ad hoc "on the fly" manner. An ALIAS is best created [like most other "objects"] to persist, to be utilized repeatedly rather than created anew each time, thus incurring the costs of creation, assignment of ownership and authority, and then deletion. Using QTEMP may be used to delay the latter costs until the CLRLIB QTEMP for job termination, but can neither delay nor avoid the former costs.

Then for example, instead of the statement referring to the ALIAS name, have the statement refer to the "FILE" name that is overridden. The two scenarios with a SELECT for example, showing how the statement can remain [near] identical for both:

create alias myAlias for myLib/myDBF (myDBFmbr)
select ... FROM myAlias
/* myAlias library-qualified in either or both of the above */
/* drop alias; perhaps */

ovrdbf myOvrName tofile(myLib/MyDBF) mbr(myDBFmbr) ovrscope(as_required)
select ... FROM myOvrName
/* dltovr; perhaps */


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.