Hi, Josh:

Have you tried this?

1. edit "scripts" (text source physical file members) to remove all qualification (library or schema names) from SQL statements.
2. Issue CHGCURLIB to the library ("schema" or collection in SQL terminology) where you want to create your tables and views.
3. issue the RUNSQLSTM with the appropriate "script" member.

You could even create a CL program to automate steps 2 and 3 above, if needed.

This seems to work, regardless of whether *SQL or *SYS naming convention is used (e.g. on the RUNSQLSTM command).

All the best,

Mark S. Waterbury

> Josh Diggs wrote:
I am looking for a way to simplify building logical files defined by sql create view statements.

Currently we use runsqlstm and specify a source file and member. This seems to work fine except when I do something like re-create a test environment. In order to insure that all of the logicals point to the correct physical, I had to go through and edit the sql source for every file in order to change libraries that were called out in the sql statement. I could let this fall through to the library list, but I prefer to call the libraries out explicitly.

Two approaches have come to mind in order to achieve this goal. One idea was to use query management queries. This allows the use of variables, but it appears that a query management object has to be recompiled after each change before the actual query can be run. I was hoping for something a little simpler.

Second, I thought of using the db2 command from qshell and setting environment variables in order to substitute the appropriate libraries. I favor this approach because it puts the source into text files in the IFS which are easier to integrate into other tools. I got stuck on how best to perform the library substitutions into a predifined sql statement in a standard way that would allow the entire process to be scripted.

How have others solved this problem?

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