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

fer sure.

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

this makes sense, since the cycle is what opens files, and srvpgms don't
use the cycle (i think?)

> > 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. :)

that's what I thought, but wasn't sure.

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

is there any discernable difference between 'nice' and 'rough', other than
the code is cleaner?

I'm not adverse to the 'file should be closed implicitely' warning message
at compile time, but i do try to write clean code whereever possible.

thanks, Scott,

"sometimes we plays it nice, and slow, sometimes we plays fast and
rough!....
      big files keep on closin'...."




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.