Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.

For information on migrating to InterSystems IRIS, see Why Migrate to InterSystems IRIS?

$JOB (ObjectScript)

Contains the ID of the current process.




$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:


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