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



You can always write a CONTINUE HANDLER for an SQL error/exception if you
don't find any of the tables needed, and if you write it in an embedded
SQLRPGLE program you simply ignore the error and you will get what is there.

HTH
JS

El vie, 12 jul 2024 a las 14:33, K Crawford (<kscx3ksc@xxxxxxxxx>) escribió:

I have a series of tables that are created to archive tables, the max
number of archive tables is 999. These tables exist in a library called
ARCHIVE. When a new table needs to be archived the process is to increment
the table number by one and drop off 999. The new table is number 000.
The list would look like this:
ETBL000
ETBL001
ETBL002
.
.
.
ETBL997
ETBL998
ETBL999

I have a program that reads each of the tables searching for a string. The
overhead of open/close is making it slower than the users like.

I am thinking about creating a view like this.
create or replace view archive.v@etbl_0
as (
select '000' as TblNumber, e.* from archive.etbl000 e
Union all
select '001' as TblNumber, e.* from archive.etbl001 e
Union all
select '002' as TblNumber, e.* from archive.etbl002 e
.
.
.
Union all
select '997' as TblNumber, e.* from archive.etbl997 e
Union all
select '998' as TblNumber, e.* from archive.etbl998 e
Union all
select '999' as TblNumber, e.* from archive.etbl997 e
)
RCDFMT v@etbl_0R
;
Downside to this is that writing the view will be a pain. but I only have
to do it once.
Another gotcha is that it is possible that a table may not exist. For
example etbl002 may have gotten deleted. This should make the SQL
statement fail.

Anyone have any better ideas?

--
Kerwin Crawford
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.