第八章 Caché 變數大全 $JOB 變數
阿新 • • 發佈:2021-01-21
技術標籤:Caché 變數大全CachéCachejob系統變數變數
文章目錄
-
第八章 Caché 變數大全 $JOB 變數 - 大綱
- 描述
- 有關當前程序的其他資訊
第八章 Caché 變數大全 $JOB 變數
包含當前程序的ID。
大綱
$JOB
$J
描述
$JOB
包含當前程序的ID號。該ID號是主機作業系統的實際程序ID(PID)。該ID號對於每個程序都是唯一的。
返回的$JOB
字串的格式由%SYSTEM.Process
類的NodeNameInPid()
方法的設定確定,用於當前程序。可以通過設定Config.Miscellaneous
類的NodeNameInPid
$JOB
僅返回PID
,但是可以設定這些函式以使$JOB
返回PID
和節點名稱。例如:11284:MYCOMPUTER
。
不能使用SET
命令修改此特殊變數。嘗試這樣做會導致<SYNTAX>
錯誤。
要將PID
建立為終端提示,請使用%SYSTEM.Process
類的TerminalPrompt(5)
方法。
有關當前程序的其他資訊
可以通過呼叫ProcessId()
方法獲得相同的當前程序ID號,如下所示:
DHC-APP>WRITE $SYSTEM.SYS.ProcessID()
22384
可以使用$JOB
獲取當前程序的JOB
編號,如下所示:
DHC-APP>SET JobObj=##CLASS(%SYS.ProcessQuery).%OpenId($JOB)
DHC-APP>WRITE JobObj.JobNumber
20
DHC-APP>zw JobObj
JobObj=<OBJECT REFERENCE>[1@%SYS.ProcessQuery]
+----------------- general information ---------------
| oref value: 1
| class name: %SYS.ProcessQuery
| % %OID: $lb("22384","%SYS.ProcessQuery")
| reference count: 2
+----------------- attribute values ------------------
| %Concurrency = 0 <Set>
| CSPSessionID = ""
| CanBeExamined = 0
| CanBeSuspended = 0
| CanBeTerminated = 0
|CanReceiveBroadcast = 1
|ClientExecutableName = "" <Set>
| ClientIPAddress = "127.0.0.1" <Set>
| ClientNodeName = "TRM:" <Set>
| CommandsExecuted = 2620
| CurrentDevice = "|TRM|:|22384"
|CurrentLineAndRoutine = "+980^%SYS.ProcessQuery.1"
| CurrentSrcLine = ""
| DataBlockWrites = 1
| GlobalBlocks = 0
| GlobalDiskReads = 24
| GlobalReferences = 379
| GlobalUpdates = 1
| InTransaction = 0
| IsGhost = 0
| JobNumber = 20
| JobType = 1
| JournalEntries = 1
|LastGlobalReference = ""
| LicenseUserId = "127.0.0.1"
| LinesExecuted = 2926
| Location = ""
| LoginRoles = "%All,%Manager,%Developer,%DB_%DEFAULT,%DB_CACHE,%DB_CACHEAUDIT,%DB_CACHELIB,%DB_CACHESYS,%DB_CACHETEMP,%DB_DOCBOOK,%DB_DTApp,%DB_SAMPLES,%DB_TrakApp,%DB_USER,%Operator,%SQL,%SQLTuneTable,DTRole,Role_dhact,Role_dhapp,Role_dhdev,Role_dhduty,Role_dhreadonly,Role_dhsuper,Role_dhview,Role_webservice,TrakUser"
| MemoryAllocated = 262144
| MemoryPeak = 192
| MemoryUsed = 186
| NameSpace = "DHC-APP"
| OSUserName = "hp"
| OpenDevices = "|TRM|:|22384*"
| Pid = 22384
| PidExternal = 22384
| PrincipalDevice = "|TRM|:|22384"
| Priority = 8
|PrivateGlobalBlockCount = 0
|PrivateGlobalReferences = 0
|PrivateGlobalUpdates = 0
| Roles = "%All,%Manager,%Developer,%DB_%DEFAULT,%DB_CACHE,%DB_CACHEAUDIT,%DB_CACHELIB,%DB_CACHESYS,%DB_CACHETEMP,%DB_DOCBOOK,%DB_DTApp,%DB_SAMPLES,%DB_TrakApp,%DB_USER,%Operator,%SQL,%SQLTuneTable,DTRole,Role_dhact,Role_dhapp,Role_dhdev,Role_dhduty,Role_dhreadonly,Role_dhsuper,Role_dhview,Role_webservice,TrakUser"
| Routine = "%SYS.ProcessQuery.1"
|StartupClientIPAddress = "127.0.0.1"
|StartupClientNodeName = "TRM:"
| State = "RUN"
| Switch10 = 0
| UserInfo = "" <Set>
| UserName = "yx"
+--------------- calculated references ---------------
| EscalatedRoles <Get>
+-----------------------------------------------------
可以從$ZJOB
特殊變數獲取有關當前程序的狀態資訊。
可以從$ZCHILD
和$ZPARENT
特殊變數中獲得當前程序的子程序或父程序的PID
。
可以從^$JOB
結構化系統變數獲取JOB
表中當前作業的PID
。