Have you tried using SETSCHEMA
... but keep in mind:
SET SCHEMA or SET CURRENT SCHEMA may work if you only want to access database objects (Files, views) without specifying the schema and all objects are located in a single schema (i.e. the CURRENT schema).
When working with SET SCHEMA the library list is no longer searched for the subsequent SQL statements (even though you may work with system naming conventions).

When setting a current library with the CL-Command CHGCURLIB CURLIB(XXX) and execute SQL Statements after, the library list is still searched for unqualified specified tables or views

Mit freundlichen Grüßen / Best regards

Birgitta Hauser
Modernization – Education – Consulting on IBM i
Database and Software Architect
IBM Champion since 2020

"Shoot for the moon, even if you miss, you'll land among the stars." (Les Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them and keeping them!"
"Train people well enough so they can leave, treat them well enough so they don't want to. " (Richard Branson)
"Learning is experience … everything else is only information!" (Albert Einstein)


-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Jon Paris
Sent: Monday, 2 February 2026 22:53
To: RPG programming on the IBM i (AS/400 and iSeries) <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Trouble managing OVRDBF inside a program

Have you tried using SETSCHEMA instead of OVR as I suggested on another forum?


Jon Paris
Jon.Paris@xxxxxxxxxxxxxx



On Feb 2, 2026, at 9:57 AM, Luca Giammattei <luca.giammattei@xxxxxxxxx> wrote:

Martin, thanks for your reply. Just to clarify, to perform the insert,
I use a procedure within a service program that does many things
beyond simply "Insert." For example, it logs and reports data errors
in the event of an insert failure. For this reason, I'm having some
difficulty changing it. But now I've realized that I can't rely too
heavily on the ovrdbf, and as a result, I find myself having to manage
a new procedure to insert into our service program. Because both the
dynamic nature of the insert and the alias creation would require modifying the existing module.
Not a big deal, but very annoying.

Il giorno lun 2 feb 2026 alle ore 15:36 Martijn van Breden <
m.vanbreden@xxxxxxxxxxxxxxxxxxxxxxxxxx> ha scritto:

Hello Luca

We have al lot of these situations in which you need to perform CRUD
operations on tables in different libraries depending on a value in
some config file.
If you don't want to create a dynamic statement you can also create
an alias for the table in Qtemp and perform the insert on that alias.
Although the "create alias" needs to be done in a dynamic statement
as well, you can wrap it in a service program and dispatch all the
alias handling and administration to that service program. Placing
them in Qtemp saves you some garbage collection.

In your program you just code
Exec sql
Insert into myAlias (x, y, z) values(:x, :y, :z) which in most
cases is easier to code that a dynamic statement


Kind regards



Martijn van Breden

lead software architect




The file is not specified in any F or dcl-f specification. The
program does not contain any F or dcl-f specification of its own.
Unless OVRDBF does an implicit opening itself.
I must add that the closing of the over dub is done by the program,
in fact at the next iteration of the cycle the data is written in the
default file present in the library list instead of in the file that
I would like to replace with the OVRDBF

Il giorno lun 2 feb 2026 alle ore 14:51 David Gibbs via RPG400-L <
rpg400-l@xxxxxxxxxxxxxxxxxx> ha scritto:


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


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


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



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