第八章 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

已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 游动-白 设计师:白松林 返回首页