× 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 Thu, 24 Mar 2005 13:18:59 -0600, Lim Hock-Chai
<Lim.Hock-Chai@xxxxxxxxxxxxxxx> wrote:
> I'm not sure why a module needs to close a file.  However, if application 
> design calls for it, you can simply, on each procedure, add the following 
> like of codes for files that it try to access:
> if      not %open(MyFile)
> open    MyFile
> endif

think of an order entry application. User enters the order info, then
a central procedure opens the files, calls the procedure to validate
the entry data, calls a second procedure to apply the data entry to
the database.   When the transaction is completed, the files are
closed. Each procedure is passed the handles to the files they will be
using.  Too many handles?  Create a data struct.  Call it
"OrderHandles".  Add a subfield to the data struct for each file that
your module of procedures will be working with.   Now when you call
the validation procedure you pass a reference to the handles data
struct.  Same thing when you call the other procedures to apply the
entry to the database.  To close the files, write a procedure that
checks each handle for null.  If the handle is not null, call the file
close function to close the handle.

-Steve

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.