failed lookup - need to close?

Larry Dannenberg LarryD at BUTLERMRDD.ORG
Fri Jul 1 11:12:48 PDT 2005


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?

 

N.B.: sv (5,.0)= "563" and i=E where E is composed of 2 fields of type
(5,.0) and the other (1,*)

 

 

  3  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -

       . If:
.

       Then: lookup imp = IMpeople k = (sv{"C") i = E -nx
.

  4  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -

       . If: not imp
.

       Then: close imp;goto newone
.

  5  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -

       . If: 'consumer in IMpeople, write updated information
.

       Then: imp(1)=2;imp(2)=3;imp(3)="C";imp(4)=17;imp(5)=16;imp(6)=sv
.

  6  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -

       . If:
.

       Then: write imp;return
.

  7  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -

newone . If: 'consumer not in IMpeople, write new record
.

       Then: lookup imp = IMpeople r = free -e
.

  8  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -

       . If: not imp
.

       Then: close imp;return

  9  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -

       . If:
.

       Then: imp(1)=2;imp(2)=3;imp(3)="C";imp(4)=17;imp(5)=16;imp(6)=sv
.

 10  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -

       . If:
.

       Then: write imp
.

 11  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -

       . If:
.

       Then: return
.

 12  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -

 

 

 

------------------------------

Larry Dannenberg

Butler County MRDD

155 Donald Drive

Fairfield, OH  45014

(513) 867-5962 ext. 35

larryd at butlermrdd.org <mailto:debbies at butlermrdd.org> 

www.butlermrdd.org <http://www.butlermrdd.org> 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.celestial.com/pipermail/filepro-list/attachments/20050701/7a2bcf09/attachment-0001.html


More information about the Filepro-list mailing list