Example:
Refer to the "Examples of ZALLOCATE" in this chapter.
L ^AR(PNT) . . . ZALLOCATE ^AR(PNT,SUB) . . . L ^TOT(TDT) . . . ZDEALLOCATE ^AR(PNT,SUB)
This LOCKs ^AR(PNT), then, after performing some unspecified commands, it ZALLOCATEs ^AR(PNT,SUB). Because ZALLOCATE does not imply any change to LOCKs or existing ZALLOCATEd resource names, the LOCK of ^AR(PNT) remains in effect. Assuming the routine does not modify the variable PNT, ^AR(PNT,SUB) is already protected by the LOCK. Next, because an unsigned LOCK releases all resource names currently LOCKed by the process, the routine releases ^AR(PNT) with the LOCK of ^TOT(TDT). This leaves the ZALLOCATE of ^AR(PNT,SUB). The name ^AR and all its subscripts except for those that begin with ^AR(PNT,SUB) are now available for LOCKing by other processes. Finally the routine releases ^AR(PNT,SUB) with a ZDEALLOCATE command. The ZDEALLOCATE does not affect the LOCK on ^TOT(TDT). Note that this example was constructed to illustrate the interaction between LOCK, ZALLOCATE and ZDEALLOCATE, and not to illustrate sound programming practice.