Lock the current record in the active work area

     RLOCK() --> lSuccess


     RLOCK() returns true (.T.) if the record lock is obtained; otherwise, it
     returns false (.F.).


     RLOCK() is a network function that locks the current record, preventing
     other users from updating the record until the lock is released.
     RLOCK() provides a shared lock, allowing other users read-only access to
     the locked record while allowing only the current user to modify it.  A
     record lock remains until another record is locked, an UNLOCK is
     executed, the current database file is closed, or an FLOCK() is obtained
     on the current database file.

     For each invocation of RLOCK(), there is one attempt to lock the current
     record, and the result is returned as a logical value.  An attempt to
     obtain a record lock fails if another user currently has a file or
     record lock on that particular record, or EXCLUSIVE USE of the database
     file.  An attempt to RLOCK() in an empty database returns true (.T.).

     By default, RLOCK() operates on the currently selected work area.  It
     will operate on an unselected work area if you specify it as part of an
     aliased expression (see example below).  This feature is useful since
     RLOCK() does not automatically attempt a record lock for related files.

     As a general rule, RLOCK() operates solely on the current record.  This
     includes the following commands:

     .  @...GET

     .  DELETE (single record)

     .  RECALL (single record)

     .  REPLACE (single record)

     Refer to the "Network Programming" chapter in the Programming and
     Utilities Guide for more information.


     .  SET RELATION: Clipper does not automatically lock all
        records in the relation chain when you lock the current work area
        record.  Also, an UNLOCK has no effect on related work areas.


     .  This example deletes a record in a network environment, using

        USE Customer INDEX CustName SHARED NEW
        SEEK "Smith"
        IF FOUND()
           IF RLOCK()
              ? "Smith deleted"
              ? "Record in use by another"
           ? "Smith not in Customer file"

     .  This example specifies RLOCK() as an aliased expression to
        lock a record in an unselected work area:

        USE Sales SHARED NEW
        USE Customer SHARED NEW
        IF !Sales->(RLOCK())
           ? "The current Sales record is in use by another"

 Files   Library is CLIPPER.LIB.



3 responses to “C5_RLOCK

  1. Pingback: C5_UNLOCK | Viva Clipper !

  2. Pingback: C5_REPLACE | Viva Clipper !

  3. Pingback: C5_RECALL | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.