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


  • Subject: RE: add file with same name from different AS/400 into pgm
  • From: bmorris@xxxxxxxxxx
  • Date: Thu, 27 Jan 2000 19:59:17 -0500




> From:   Stone, Joel [SMTP:StoneJ@GourmetAward.com]
> Sent:   Wednesday, January 26, 2000 4:29 PM
>
> I need to add an order file to a inquiry RPG pgm.  The file has the same
> name as a file already in the pgm.  What is an easy way to accomplish
> this???
>
> Only one of the files must be open at any point in time, but a user could
> look at one file and then the other in the same session.
>
> Call qcmdexc to ovrdbf and re-open the file with each read to the orders?
>
> Note: I dont think I can use an LF to combine the files, because the
> second file is on another box using DDM, which is sometimes down.  If the
> DDM file is down, I still want the user to be able to see his local
> orders!
> ...

Joel, since you've said that only one file can be open at once, and since
it sounds like the formats of the two files are the same, I think the
solution you've suggested is the best (and easiest) one: call
qcmdexc(ovrdbf) and re-open the file.  You don't need to do it on each read
- just when the file is different from the one you have open (the INFDS has
the library/file/member of the file actually open).

If the time taken to do all the closes and opens turns out to be a problem,
and if you COULD allow have both files to be open at once, you might
consider using the 2 F-spec version and keep both files open.  If you do
this, don't use PREFIX, because that would entail two versions of your
logic to handle the fields.  And you should do a FEOD on the old file when
switching files to ensure you don't update one file with data from another.
I don't know if this would be very easy though, since you'd have to have
add logic to every I/O to decide which file or record to read:
  C          if    usingDDM
  C          read  ddmFile
  C          else
  C          read  localFile
  C          endif
Ewwww!

Barbara Morris


+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


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.