Too Many Open Files (was Re: The CLOSE command)

Jeff Harrison jeffaharrison at yahoo.com
Fri Feb 17 15:54:40 PST 2006


--- John Esak <john at valar.com> wrote:

> >
> > That works fine unless you have multiple lookups
> that
> > re-use the same alias.  For example:
> >
> > lookup fil = file1 k=ky i=a -nx
> > lookup fil = file2 k=ky i=a -nx
> > lookup fil = file3 k=ky i=a -nx
> > close fil
> >
> > The above code only closes the open files from
> file3.
> > I would like an option to close all of the open
> files
> > from lookups.
> >
> > Jeff Harrison
> 
> Please don't take offense. (You always do, though...
> hopefully not this
> time) The above snippet of code is simply bad
> programming. 

Yes, I often take offense with YOUR statements.  I
generally don't run into that problem with others
though.  No offense taken this time... Yet :-)  The
above example was just a test to show the (in my
opinion) - bad behaviour of filepro.

I don't normally use that technique of re-using the
aliases with different files.  As I mentioned
previously, where I saw the problem was with the code
written by someone else at a company that I worked for
in the past.

> Think about it.
> You open one lookup with an alias, than another
> lookup with the same alias
> and don't *close* the first lookup. What do you
> expect? It is certainly
> clear that you can not have access to the first
> lookup if you use the same
> alias to the second lookup and so on... so, why not
> close any lookup for a
> particular alias before you re-use that alias.

Ah, but why not have filepro do it automatically? 
There are many instances where filepro does the
reasonable thing - such as automatically protecting
lookups when a write occurs.  

In my opinion most filepro programmers are "close
happy".  By that I mean they issue unnecessary closes
to files all the time - often just to use it again
soon after the close - instead of letting filepro
handle the closing where it can and should.

This issue, unfortunately, could well have the result
of making programmers even more "close happy".

[snip]

> As to this, should you want to be even more precise
> about open lookups, (in
> many instances this is not very critical), you need
> to close lookups that
> failed as well as those that don't.
> 

In my opinion you should only close lookups when there
is a need to do so.  Failed or not I would GENERALLY
not bother closing any given lookup.  There are of
course some cases where the close is necessary.

[snip]

> Having lots of open files is not a problem for
> filePro, they get closed when
> they should be by clerk or report as they should be.
> So, unless it is
> something like your example, or Howie's, the problem
> will probably never
> manifest in any way.
> 

Since filepro is supposed to close files dynamically
as needed, I would think the "too many open files
open" error would be pretty much gone except for
people that are running into this issue.  I have no
Idea how much of a problem this is for people out
there - I figured I would mention this though as a
possible heads up for the people on this list.

Jeff Harrison
jeffaharrison at yahoo.com

Author of JHExport and JHImport.  The easiest and
fastest ways to generate code for filePro exports and imports.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Filepro-list mailing list