The lock statement sets one of 992 execution locks. This prevents re-entry to the program, allowing only one process to run the program at any given time.
lock lock.num{then|else statement.block}
lock.num | Specifies the line number (from 0 to 991) to lock. If lock.num is greater than 991, the result is divided by 992, and the lock number is equal to the remainder of the equation. |
The following information applies to the lock statement:
If present, the else clause is executed.
It is assumed the programmer is doing what they need within the programming clauses.
Example 1
This example unconditionally sets execution lock 12.
lock 12
Example 2
This example attempts to set lock 14.
If it is already locked, the program advises the operator and stops.
lock 14 else crt "Program is locked" ; stop