Record locking

Mike Schwartz-PC Support & Services mschw at athenet.net
Tue Mar 30 19:17:30 PST 2004


> Changed the line again:
> 15	  if:
> 	 then: emm(10)= purchase_order_number+"1";wrtie emm;sync emm;close
> emm
> 
> Repeated above steps, this time the record was unlocked right away.

	(note:  I presume your misspelling of the word "write" in all of
your examples is a typo...)

	My philosophy has always been to open the control file, then process
the minimum amount of instructions that I need to do to get the number and
increment it, and then write and close the control file.  All of this should
(preferably) be in one line of code, or two lines, if you include the lookup
line.  There should probably never be anything that can slow down this
function, such as an "errorbox" or a "gosub" or any other processing. 

	I have *always* done a "write" and then a "close" in a situation
like this, where I'm working with a control file.  If I didn't do it this
way, I can show you instances of this type of code not working correctly
dating all the way back to filePro version 0.95 on Tandy Model 16's.

	(Gee, I wish I had a tape recording of the squeeking noise that the
old 8 meg drives used to make as they were rebuilding indexes.  Just for
nostalgia's sake...)

	I don't usually use the "sync", although I have found that I needed
to use it on a couple of Windows systems when I moved filePro 4.5 for DOS
programs onto Windows '98 computers that were faster than about 900 Mhz.  I
don't know what the real problem was.  Perhaps it was the speed of the
computers, or perhaps the new ATA hard drive controllers.  I just know that
"sync" fixed the problems.

	I don't know if it makes any difference, but I usually do a "write"
then "close", then "sync".  I probably just need to do "close" then "sync".

	There shouldn't be any speed penalty for doing the extra "closes",
considering the speed of today's computers.  There was a noticeable speed
penalty if I had to keep reopening a closed file on the old Tandy 16's.

	You probably should not allow the errorbox or any other processing
lines that might hold up the control file *before* you do the close and
write, although if the master control record has been deleted, that's
probably academic.    

*** Mike Schwartz ***
*** PC Support & Services, Appleton, WI ***





More information about the Filepro-list mailing list