Example 1:
SET x=$ZLKID(0) F cnt=0:1 Q:x="" S x=$ZLKID(1)
This uses $ZLKID() to count the number of currently accessible VMS locks.
Example 2:
SET L=$ZLKID(0)
FOR Q:L="" D
.I $ZGETLKI(L,"RESNAM")="GTM$LM" SHWJOB($ZGETLKI(L,"PID"))
D
.SET L=$ZLKID(1)
QUIT
This uses $ZLKID() and $ZGETLKI() to identify GT.M processes based on whether they hold a VMS lock with the resource name "GTM$LM". Once the routine has identified a process, it invokes the subroutine SHWJOB passing the VMS PID. For a more extensive example, refer to the "M Utility Routines" chapter in this manual GT.M Programmer's Guide.