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



I might be calling this in a loop; for sure every displayed record. I have
the activation group as *CALLER. So all I have to do is check to see if the
file is open, and if it is to just continue processing?

On 7/19/07, Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx> wrote:

Opening a file is a very expensive operation. (One of the most expensive
ones that I use on a regular basis, in fact.)

So I guess the real question is: How often do you expect your procedure
to be called? Are there programs (or can you envision a scenario) that
need to call your procedure over and over in a loop? If so, I'd say
that opening and closing the file each time is a bad idea. It's suicide
to performance.

In my experience, the most common (and probably best) practice is to
open the file once, and then just leave it open until the activation
group or job ends. Some people provide additional routines to allow
the caller to explicitly re-open or re-close the files without having to
end the activation group.

Are there circumstances where it makes sense to open the file on every
call to the procedure? Absolutely. It really depends on what you're
doing! But, in 95% of the cases, you want to leave the file to improve
the performance of subsequent calls.


Mike wrote:
> Maybe I worded it wrong. "Best Practice" maybe?
>
> It looks like others do the same thing open and close the file on every
> call. I didn't know if I could or should keep the file open while the
main
> program is running. This is in a module by the way.
>
--
This is the RPG programming on the AS400 / iSeries (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.