|
Sue,--
Thank you for providing this. The timing was perfect. I have a need
for it today. 😊
However, I have a problem and I'm hoping you can help.
I have an SQLRPGLE program named SISSRCANL/SAROBJKEEP that does SQL to a PRODBOX to retrieve the object_statistics.
The variable sqlStmt contains the following (cut from the debugger and pasted/reformatted)…
select objlib,
objname,
objtype,
objat00001,
coalesce(objtext,''),
coalesce(last_00001, '0001-01-01-00:00:00.000000')
from table(object_statistics('MYLIB', '*ALL'))
where date(last_00001) >= '2019-01-01'
and exists (select 1 from prodbox.sysibm.sysdummy1)
When I execute the prepare
exec sql prepare s1 from :sqlStmt;
I receive an error.
SQLCOE = -805
SQLERM = SAROBJKEEP █SISSRCANL00PRODBOX
In the joblog I see
Database connection started over TCP/IP.
CONNECT to relational database PRODBOX completed.
There is nothing in the joblog for the SQL0805. From the message, it looks like it can't find a package on PRODBOX named SISSRCANL/SAROBJKEEP.
If I run the above SQL interactively (not in a program), it works.
Can you tell me what is causing the SQL0805 in the program or at least point me in the right direction?
Thanks.
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Sue
Romano
Sent: Monday, November 2, 2020 2:38 PM
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Subject: RE: Gathering Object Statistics Across LPARs
Three part name qualification only works for tables and views, not for
table functions. If you had been at my Hidden Gems session at the RPG
and
Db2 Summit earlier today, you would have seen this method to get around that restriction. The query will be directed to whichever LPAR the table qualification says to use. In this example, a meaningless predicate is added to cause the query to be run on RMTDB.
select objname, date(Last_used_timestamp) as LastUsedDate, objtext
from table (QSYS2.OBJECT_STATISTICS('LIBRARY','*PGM') ) AS X where
exists (select 1 from rmtdb.sysibm.sysdummy1) order by objname ;
Sue Romano
Db2 for IBM i Development
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a
message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
As an Amazon Associate we earn from qualifying purchases.
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.