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



Mike,

My short answer is "Of course it can be done".  Not sure what you are really
after, but you could simply set up two loops, one for file1 and one for
file2.  A couple of hints, though... if you use a physical and one of its
logicals in the same program, you will need to RENAME one of the format
names (same is true if you were using to logicals that share a format name).
Also, you SHOULD rename every field in file1 or file2 (or both) so that
there are no residual data problems.  If you are using RPGIV this is very
easy with prefix.

Here is a sample of both of these approaches...

fsalewrkf  uf a e           k disk    prefix(lo_)
f                                     rename(salrwrk:salrwrko)
fsalewrk1  uf   e           k disk    prefix(l1_)
f                                     rename(salrwrk:salrwrk1)

salewrkf is a physical, salewrk1 is a logical built over the physical.  Now
anytime I refer to a field in either file I know exactly which file the
field is coming from...

In SALEWRKF, field CUSNUM will now be referred to in the RPG as lo_CUSNUM.
Any updating/deleting/writing to either file will now refer to the renamed
format (SALRWRKO instead of SALRWRK).  None of these are case sensitive,
merely included for emphasis.

HTH,
Joel

>-----Original Message-----
>From: Wills, Mike N. (TC) [mailto:MNWills@taylorcorp.com]
>Sent: Friday, January 04, 2002 10:27 AM
>To: Midrange - RPG (E-mail)
>Subject: Reading 2 different files with the same fields
>
>
>I have a program that needs to run on 2 different files on different runs.
>So that the first run will process file1 & file1a (same file different
>logical), the second run will process file2 & file2a (same file different
>logical). Both files have the same field names. Can I do this with one
>program? How is this done?
>
>Mike Wills
>Taylor Corporation
>IT Corporate Support
>mnwills@taylorcorp.com
>Phone: (507) 386-3187


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.