Home > Class Reference > ENSLIB namespace > %SYS.LockQuery

%SYS.LockQuery

abstract class %SYS.LockQuery extends %SYSTEM.Help

Provide Interface for users to read lock table information in the system. SYS.Lock is used to perform management operations.

Filter Specification

The argument to the Rset.Execute() method selects which subset of the current locks to return. The first character of the 'id' argument determines the category of the locks to be collected. This has various forms as described below.
1) Null String or "*" - All locks. When the 'id' is a null string (default value when no id specified) or "*", it collects all locks in the lock table. Example:
  Set Rset=##class(%ResultSet).%New("%SYS.LockQuery:List")
  //Collect all locks in lock table.
  Do Rset.Execute("")
   
  Set Rset=##class(%ResultSet).%New("%SYS.LockQuery:List")
  //Collect all locks in lock table.
  Do Rset.Execute()
  
2) 'P' or numeric - Process ID. Collect all locks owned by the job with the specified process ID. If the 'id' is a numeric value without a leading 'P', it is treated as a process ID.
For all systems the process ID is in decimal form.
Example:
  Set Rset=##class(%ResultSet).%New("%SYS.LockQuery:List")
  //Collect all locks owned by a process whose process ID is 2004.
  Do Rset.Execute("P2004")
   
  Set Rset=##class(%ResultSet).%New("%SYS.LockQuery:List")
  //Collect all locks owned by a process whose process ID is 2004.
  Do Rset.Execute("2004")
  
3) 'J' - Internal job number. Collect all locks owned by the job with the specified internal job number.
Example:
  Set Rset=##class(%ResultSet).%New("%SYS.LockQuery:List")
  //Collect all locks owned by a process whose internal job number is 20.
  Do Rset.Execute("J20")
  
4) 'C' - Remote client system Name. Collect all locks owned by the remote client system with the specified name.
The Name can be one of the names displayed in the 'Process ID' column of the ^LOCKTAB utility.
When the string following the leading 'C' is empty, it collects all locks owned by jobs of the local system.
Example:
  Set Rset=##class(%ResultSet).%New("%SYS.LockQuery:List")
  //Collect all locks owned by jobs of local system.
  Do Rset.Execute("C")
   
  Set Rset=##class(%ResultSet).%New("%SYS.LockQuery:List")
  //Collect all locks owned by remote client named 'SystemA'.
  Do Rset.Execute("CSystemA")
  
5) 'S' - Remote server system Name. Collect all locks sent to the specified remote system.
When the string following the leading 'S' is empty then it collects all locks kept on the local system.
Example:
  Set Rset=##class(%ResultSet).%New("%SYS.LockQuery:List")
  //Collect all locks on the local system.
  Do Rset.Execute("S")
   
  Set Rset=##class(%ResultSet).%New("%SYS.LockQuery:List")
  //Collect all locks sent to remote server named 'SystemA'.
  Do Rset.Execute("SSystemA")
  
6) 'N' - Network Protocol. Collect all locks owned by the remote client system through the network protocol. The protocol can be: Example:
  Set Rset=##class(%ResultSet).%New("%SYS.LockQuery:List")
  //Collect all locks owned by remote ECP clients.
  Do Rset.Execute("NECP")
   
  Set Rset=##class(%ResultSet).%New("%SYS.LockQuery:List")
  //Collect all locks owned by remote clients.
  Do Rset.Execute("N")
  

Method Inventory (Including Private)

Methods (Including Private)

classmethod AnyRemoteOwnedLocks(NetType As %String = "") as %Boolean
Check if any remote system owns any lock in the system.
Return TRUE(1) if there is any lock owned by the specified network type, otherwise return FALSE(0).

The NetType argument specifies the network type of the remote system.
It has following value:
  • "NECP" - The remote system owned the lock through ECP network.
  • "N" or "" - The null string (Default) means any network type.
For un-recognized network type this method will return FALSE.
Example:
  // Return 1 if any lock is owned by remote ECP client.
  Set rc=##Class(%SYS.LockQuery).AnyRemoteOwnedLock