Trouble managing OVRDBF inside a program
Posted: Thu Jan 29, 2026 4:11 pm
IIn my IBM i, we manage multiple companies. Each company has its own data library, and the company data libraries all have more or less the same files.
I receive a file from outside and need to manage it by writing some data to some companies, but not all of them.
So, in my program I have a situation like this (in semipseudocode):
pgm is an sqlrpgle, data insert is done via "exec sql insert into", pgm has no dcl-f or any f spec used, btw when running the first over dub file it works like a charm, while the second time (or the third or the fourth) the OVRDBF command does not work, and I don't see anything in the DSPJOBLOG, substitions checked via DSPOVR command shows nothing happened, I am for surely missing something, can any kind soul out there point me to what i am missing? TIA
I receive a file from outside and need to manage it by writing some data to some companies, but not all of them.
So, in my program I have a situation like this (in semipseudocode):
Code: Select all
dcl-ds MyDS qualified Inz dim(20);
companyLib char(10);
foo char(2);
bar char(12);
rtw likeds(rowsToWrite) dim(25);
End-DS;
---
doU MyDS(x).companyLib = *blanks;
If %trim(MyDS(x).companyLib) <> defaultCompany;
rc=DoCmd('OVRDBF FILE(MyFILE00F) TOFILE(' + %trim(MyDS(x).companyLib) + '/MyFILE00F)');
if rc <> 0;
logError(yabadaba);
iter;
else;
rc=insertCompanyData(MyDS(x).rtw);
if rc=0;
exec sql commit;
else;
logError(anotheryabadaba);
endif
rc=DoCmd('DLTOVR FILE(MyFILE00F)');
if rc <> 0;
logError(yabadabadoo);
endif;
endif;
endIF;
x +=1;
endDo;