|
Any file opened by RPG, either EXTNAME or OVERDBF, must have teh same
record format as the file listed on the f-spec did when the program
was compiled.
Dynamic SQL is a better option.
d wfile s 10a
d wSQL s 100a varying
for x = 1 to %elem(pa);
wSQL = 'delete from ' + pa(x) + ' where PLCY = ' + policy;
exec SQL execute immediate wSQL;
///add standard error handling
endfor;
HTH,
Charles
On Fri, Apr 3, 2009 at 12:12 PM, Gene Burns <burns.gene@xxxxxxxxx> wrote:
I am trying to use usropn and extfile, in V5R4, to process 112 files forfile
deletions. I have the following specs:
fwrkfile uf e k disk usropn extfile(wfile)
d wfile s 10a
for x = 1 to %elem(pa);
wfile = pa(x);
open wrkfile;
setll policy wrkfile;
dou %eof(wrkfile);
reade policy wrkfile;
if NOT %eof(wrkfile);
if x = 1;
hldr = pchr60;
endif;
delete(e) wrkfile;
endif;
enddo;
close wrkfile;
endfor;
pa is a 10a array of file names.
I am updating wfile from arrays that contain the file names. The first
is processed successfully and closed, but when the program tries to openthe
second file I get CPF4131, Level Check.and
I checked the file and it had been changed this morning, so I recompiled
ran the program again. CPF4131, Level Check on the second file again! Iit
have a file named WRKFILE in my development library and I thought maybe
was using the date from that file. So I deleted and recreated that fileand
recompiled again. Still got the CPF4131 on the second file. Then Ideleted
the WRKFILE file and recreated it using a different record format, it didrecord
have the same record format as the first file in the array.
This time I got the CPF4131 on the FIRST file in the array.
The problem seems to be when it tries to open a file with a different
format from the file specified in positons 7-16 of the f-spec.files
Is there a way around this? Or is this keyword only good for opening
with the same record format in different libraries?list
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
To post a message email: RPG400-L@xxxxxxxxxxxx--
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.