Progress
Language Reference


LOCKED Function

Interfaces
OS
SpeedScript
All
All
Yes

Returns a TRUE value if a record is not available to a prior FIND . . . NO-WAIT statement because another user has locked a record.

SYNTAX

LOCKED record 

record

The name of a record or buffer.

To use the LOCKED function with a record in a file defined for multiple databases, you must qualify the record’s filename with the database name. See the Record Phrase reference entry for more information.

EXAMPLE

The FIND statement in this procedure tries to retrieve a customer record according to a supplied customer number. Because of the NO-ERROR option, the FIND statement does not return an error if it cannot find the record. The NO-WAIT option causes FIND to return immediately if the record is in use by another user.

r-locked.p
REPEAT:
    PROMPT-FOR customer.cust-num.
    FIND customer USING customer.cust-num NO-ERROR NO-WAIT.
    IF NOT AVAILABLE customer THEN DO:
        IF LOCKED customer
        THEN MESSAGE "Customer record is locked".
        ELSE MESSAGE "Customer record was not found".
        NEXT.
    END.
    DISPLAY cust-num name city state.
END. 

A record might not be available if it is locked (being used by another user) or does not exist. The LOCKED function returns a TRUE value if the record is locked. In this case, the r-locked.p procedure displays a message that the record is locked. If the record is not locked, the procedure displays a message that the record does not exist.

SEE ALSO

AMBIGUOUS Function, AVAILABLE Function, FIND Statement, NEW Function


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095