Trouble managing OVRDBF inside a program
Luca Giammattei <[email protected]>
| Newsgroups | gmane.comp.lang.as400.rpg |
|---|---|
| Message-ID | <CABj10vWzpa4cRhA8C1x+RssG1oNHzsYmoFc2M2WSWwGHxpm8KQ@mail.gmail.com> |
Hellò everybody.
In 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 an ascii 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):
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;
The program runs with a user who has associated a job description that
contains the list of libraries for company A, let's call it the default or
main company, but it must also be able to write to the file present in the
data library of company B and company C o D, one of the many other
companies we manage. Program is an sqlrpgle, data insert is done via "exec
sql insert into", pgm has no dcl-f or any f spec used, 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
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: [email protected]
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact [email protected] for any subscription related questions.