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



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 for
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 file
is processed successfully and closed, but when the program tries to open the
second file I get CPF4131, Level Check.

I checked the file and it had been changed this morning, so I recompiled and
ran the program again.  CPF4131, Level Check on the second file again!  I
have a file named WRKFILE in my development library and I thought maybe it
was using the date from that file.  So I deleted and recreated that file and
recompiled again.  Still got the CPF4131 on the second file.  Then I deleted
the WRKFILE file and recreated it using a different record format, it did
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 record
format from the file specified in positons 7-16 of the f-spec.

Is there a way around this?  Or is this keyword only good for opening files
with the same record format in different libraries?
--
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 thread ...

Follow-Ups:
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.