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



Jerry, I think I understand now.

There is no way to point CREATE TABLE statement to a DDS source member.

You can have source members that do CREATE TABLE and then point RUNSQLSTM to
it and create tables (files) that way, but that method does not satisfy your
requirement as you want to be able to reuse that source to create another
table and RUNSQLSTM does not allow dynamic file naming.

You can accomplish what you want via QMQRYs (as someone already pointed that
out). For example, lets say you have a source physical file called
QQMQRYSRC. In it you create a source member (similar to creating a new DDS
source member), let's call it GENERICTBL. In that source member you have
your CREATE TABLE statement, i.e.:

CREATE TABLE &library/&file (F1 INTEGER NOT NULL WITH DEFAULT)

Then you create your QMQRY object (this is a one time step only):

CRTQMQRY QMQRY(myLib/GENERICTBL) SRCFILE(mySrcLib/QQMQRYSRC)

Now you can use that QMQRY object any time you want to create the table with
exact same format, passing in the library and file parameters as you please,
i.e.:

STRQMQRY QMQRY(myLib/GENERICTBL) NAMING(*SYS) SETVAR((LIBRARY fileLib)
(FILE newFileX))

All that said, I think it's cleaner to create a "field reference file" and
then use CREATE TABLE AS ... and let system figure out all the formatting
etc., but that's just me :)

HTH, Elvis

Celebrating 10-Years of SQL Performance Excellence
http://centerfieldtechnology.com/training.asp

-----Original Message-----
Subject: Re: SQL DDL Create Table Names

Elvis,

Thanks for the link. Though I hadn't checked that one out ahead of
time, I had gone to a couple of others and some printed (gasp!) material
beforehand.


It may be that I am either not understanding the response or that I
didn't make myself clear. Which, in either case, is my fault. So let's
see if I can do at least a little better.


We can give a DDS source member any name, FILEJ, for example. On the
CRTPF or CHGPF commands there is a FILE parameter and the value used,
JFILE, for example, points to (or creates) a specific file named JFILE
based upon the source member (FILEJ) provided. I.e., while usually the
DDS source member and physical file have the same names, it ain't
necessary; the name of the file to be created (or changed) is not
inherent inside the DDS source member.


Now, if I understood your example and the other reading, "newTable" is
the actual name of the table that will be created. There is no way that
I have seen/found to use this same source member to create "newTableX".
Or is there? If not, I'll have to stick with DDS for these mirror-image
tables and use SQL for the unique tables (new or old).


* Jerry C. Adams




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.