Previous Topic: &LOCK Verb

Next Topic: Alter the Status of a Resource Lock

Wait for Access to a Resource

If a procedure issues &LOCK to request access to a resource lock, but the required access cannot be granted immediately, the WAIT operand specifies whether the system will return control to the procedure immediately, or wait for the resource to become available.

If you specify WAIT=YES, your procedure will be suspended indefinitely until access to the required resource can be obtained. You should avoid this, unless you are certain that a deadlock condition with another process in the system will not result.

Rather than code WAIT=YES, CA recommends that you use the WAIT=nnnn option. This instructs the system to wait for the required resource for a certain number of seconds (as specified by the nnnn variable), rather than waiting indefinitely. If the lock is still not available after that time, the procedure resumes processing. This stops deadlock conditions occurring.