>I can not get the following code to lock a record. What can can cause this failure? I've got multilocks on, and reprocess set to automatic for testing.
>
>STORE recno() to gcreclist2
>DO WHILE NOT RLOCK('myfile')
> RLOCK(str(gcreclist2), 'myfile') &&& Lock clinical record
> IF NOT RLOCK()
> Wait window "Somebody else is working on this record"
> ELSE
> UNLOCK
> ENDIF
>ENDDO
>
>thanks
The above code attempts to lock the current record in alias myfile once, record number gcreclist2 in alias myfile once and the current record in the current alias once.
These may be trying to lock the same record in the same alias or they may not. RLock() and FLock() not only return a logical value they also do the act. They actually attempt to lock the record or file and then return whether the attempt was successful. By having multiple calls to the function, you are introducing a lot of overhead to the process (especially if this is a network application and you connection is rather slow).
What work area are you in when you call this code? The recno() function does not specify an alias so it is using the current alias. Is this the work area you want? Maybe you should specify the alias as well here (i.e. recno('myfile')).
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao