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



OK, that was painful but I finally figured it out.

The SQLPKG parameter on the CRTSQLRPGI defaults to *OBJLIB/*OBJ. At "prepare" time, the program was trying to create an SQLPKG on the PRODBOX named SISSRCANL/SAROBJKEEP. The problem was SISSRCANL does not exist. It would have been nice if it had just told me that was the problem.

I changed the SQLPKG parm to QTEMP/SAROBJKEEP and it works. Unfortunately, you can't add this as a COMPILEOPT as part of the set options inside the RPG so I have to remember to do it every time I recompile.

Now I'm stumbling over SQLCOD 462 due to authority issues with specific objects but that is a whole different ballgame.

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Bryan Dietz
Sent: Thursday, November 5, 2020 11:22 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Gathering Object Statistics Across LPARs

one place to start
check your authorities on the target server.
look for AF entries in QAUDJRN.

see if you can capture the joblog for the job that starts on the prod server.

Bryan

smith5646midrange@xxxxxxxxx wrote on 11/4/2020 12:42 PM:
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

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