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



Gene,

This *can* be done with keyed access, if you define the file as
program-described *and* if the policy field is at the same position in the
record format of all the files you want to access (it may also have to be at
position 1). Specify multiple external DS's (using e.g. EXTNAME - one per
external file) and an INFDS on the file.

With this method, you open the file, check the infds to see what file it is
(and therefore what record format to use), read the file into the record
format and do a READ through the file (or a SETLL/READE if that's possible -
can't remember how well keyed operations work on program-described files).

Or use SQL, as Charles suggests. SQL is probably 'easier', unless you and
your colleagues have no experience with SQLRPGLE programs and cringe at the
sight of them. Even so, though, the RPGLE-only approach is pretty complex. I
have some example code if you want.

Rory

On Fri, Apr 3, 2009 at 9:12 AM, 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 ...

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.