docs.intersystems.com
Home / ObjectScript Reference / ObjectScript Special Variables / $JOB

ObjectScript Reference
$JOB
Previous section           Next section
InterSystems: The power behind what matters   
Search:  


Contains the ID of the current process.
Synopsis
$JOB
$J
Description
$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() method of the %SYSTEM.Process class. The system-wide default behavior can be established by setting the NodeNameInPid property of the Config.Miscellaneous 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.
To establish the PID as the terminal prompt, use the TerminalPrompt(5) method of the %SYSTEM.Process class.
Other Information About the Current Process
You can obtain the same current process ID number by invoking the ProcessId() method, as follows:
   WRITE $SYSTEM.SYS.ProcessID()
Refer to the %SYSTEM.SYS 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.ProcessQuery 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 PID of the child process or the parent process of the current process from the $ZCHILD and $ZPARENT special variables.
You can obtain the PIDs of the current jobs in the job table from the ^$JOB structured system variable.
See Also


Previous section           Next section
Send us comments on this page
View this book as PDF   |  Download all PDFs
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-06-26 06:27:05