failed lookup - need to close?
Nancy Palmquist
nlp at vss3.com
Fri Jul 1 13:20:13 PDT 2005
Larry Dannenberg wrote:
> In lines 4 and 8 below, if the lookup fails, the file is closed. A
> colleague I work with mentioned that it is not necessary to "close" the
> file if the lookup fails because the file was never opened.
>
>
>
> Is it good programming technique to directly "close" the file or is it
> an unnecessary step?
If the use of a handle is of importance to the function, then close it
if you are going to use it.
In the case where resources are tight and you check for data and none
exists and none will be created in that file, you might do a close just
to allow that handle to be used for another file.
In most cases, this is not necessary, but I have some few routines where
only occasionally does the record access the file and if it is not used,
I close it to allow other lookups to use the handle. I have found
success with Windows system that do a lot of lookups in one process
table. Resources may cause the process to crash if you exceed the stuff
with a lot of unused lookups. Speed is sacrificed but machines are so
fast that is hardly an issue if the alternative is that the process crashes.
If you will access the file with a lookup r=free anyway on every record,
close is a waste of time.
Nancy
--
Nancy Palmquist MOS & filePro Training Available
Virtual Software Systems Web Based Training and Consulting
PHONE: (412) 835-9417 Web site: http://www.vss3.com
More information about the Filepro-list
mailing list