$JOB contains the ID number of the current process. This ID number is the host operating system’s actual Process ID (PID). This ID number is unique for each process.
The format of the string returned to $JOB is determined for the current process by the setting of the NodeNameInPid()Opens in a new window method of the %SYSTEM.ProcessOpens in a new window class. The system-wide default behavior can be established by setting the NodeNameInPidOpens in a new window property of the Config.MiscellaneousOpens in a new window class. By default, $JOB returns only the PID, but you can set these functions to have $JOB return both the PID and the node name. For example: 11284:MYCOMPUTER.
This special variable cannot be modified using the SET command. Attempting to do so results in a <SYNTAX> error.
Other Information About the Current Process
You can obtain the same current process ID number by invoking the ProcessId()Opens in a new window method, as follows:
Refer to the %SYSTEM.SYSOpens in a new window class in the InterSystems Class Reference for further details.
You can use $JOB to obtain the job number for the current process as follows:
SET JobObj=##class(%SYS.ProcessQuery).%OpenId($JOB) WRITE JobObj.JobNumber
Refer to the %SYS.ProcessQueryOpens in a new window class in the InterSystems Class Reference for further details.
You can obtain status information about the current process from the $ZJOB special variable.
You can obtain the PIDs of the current jobs in the job table from the ^$JOB structured system variable.