Announcement

Collapse
No announcement yet.

Unlocking RANDOM file records

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unlocking RANDOM file records

    I've been working on an app which occasionally locks individual records
    of a file opened as RANDOM. I was just testing the use of UNLOCK #Dev%
    to unlock all the records that were locked individually. I noticed that
    it didn't matter if I unlocked them at all. Upon closing the file, the
    records were unlocked. Is it necessary to execute the UNLOCK statement?



    ------------------
    Bernard Ertl
    Bernard Ertl
    InterPlan Systems

  • #2
    Typically, a locked file be unlocked when the file is closed, but it is "best practice" to explicitly unlock everything you lock.

    Problems are rare on local drives, but file locking/unlocking across a network may be more prone to problems since there are additional factor beyond the control of your app. For example, if you are locking records on a peer server running some obscure networking software, then you could find that the the individual records are still locked even though you unlocked the file as a whole (IOW, some O/S's may not react as you may anticipate).

    Therefore, my advice is this: if you locked individual records, then I'd suggest unlocking the same records individually. Only unlock the whole file if you actually locked the whole file.


    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      OK. Thanks for the clarification Lance.



      ------------------
      Bernard Ertl
      Bernard Ertl
      InterPlan Systems

      Comment

      Working...
      X