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




On Tue, 23 Sep 2003 rick.baird@xxxxxxxxxxxxxxx wrote:
>
> I would prefer to leave the file closed until i call one of the functions
> that use it, then i'd like it to remain open until the calling program is
> done.

before using it do:

       if not %open(MYFILE);
          open MYFILE;
       endif;

>
> Should I let the program open the file or open it myself?
>

For some reason (maybe just because the compiler generates a warning) it
is considered "wrong" to let the program open the file in a service
program.


> If I open it myself, will it close automagically when the current
> activation group ends?

No matter what you do, it's going to be closed when the activation group
ends. :)

However, I think it makes for better code if you close it manually instead
of letting the environment do it.   For this reason, I often code
procedures like:
        mysrvpgm_load() -- called when a program first references the
                             service program.
      mysrvpgm_unload() -- called when a program is done with the
                             service program.

Another option, if you want the files to open/close "automagically" (from
the callers point of view, anyway) would be to register a procedure to be
called when the activation group is ended which can close the files
nicely.



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.