-p on LOOKUPs - further clarification?

Jeff Harrison jeffaharrison at yahoo.com
Fri Jun 15 12:13:04 PDT 2007


--- "Jay R. Ashworth" <jra at baylink.com> wrote:

> On Fri, Jun 15, 2007 at 09:31:19AM -0700, Jeff
> Harrison wrote:
> > --- Dennis Malen <dmalen at malen.com> wrote:
> > > Can you clarify the use of the -P, protected
> lookup. Is the list
> > > saying that if you want to write to a lookup
> file that you use the
> > > -P? I was under the impression that you use the
> -P only if you were
> > > pulling information from the lookup file.
> >
> > The -p should be used ONLY when you do a lookup
> where you intend to
> > do a write. It sounds like you had it backwards -
> which I believe is
> > probably giving you all kinds of grief with
> unnecessary record locks
> > all over the place. Also data corruption could be
> caused by not using
> > the -p when needed.
> 
> So, when you say -p, filePro write locks the target
> record (and
> associated index records) *while it is writing that
> data item* -- and
> unlocks it automagically afterwards?
> 
> How does that interact with filePro (presumably)
> caching all write
> updates to a record until you save it?
> 
> If Ken hasn't already, recently, would you (Ken)
> mind recapping
> *precisley* what set of steps occur that differ when
> a lookup has a -p
> flag, and when a field in that lookup-file is
> written into?  (Or,
> y'know, you can do it, Jeff, if you remember exactly
> :-)
> 

As I understand it, a record lock is placed on the key
or data file when a lookup -p is executed
successfully.  The mechanism for unlocking the record
is not "automagic" exactly.  If you close the lookup
or execute an explicit "write" to the lookup it will
release the lock. Also, I believe it will release if
you execute another lookup with the same alias.
Otherwise, I believe that the lock will be released
once the processing finishes for the current record -
ie in input or output processing when it comes to an
"end".  In "@w*" processing, etc, it will just leave
the lock in place.

Strictly speaking, I don't think that filepro does
cache any writes - I would presume that this would be
handled by the OS if appropriate and should work
transparently.


Jeff Harrison
jeffaharrison at yahoo.com

Author of JHExport and JHImport.  The fastest and
easiest ways to generate filepro exports and imports.


       
____________________________________________________________________________________
Choose the right car based on your needs.  Check out Yahoo! Autos new Car Finder tool.
http://autos.yahoo.com/carfinder/


More information about the Filepro-list mailing list