$JOB (ObjectScript)
構文
$JOB
$J
概要
$JOB は、現在のプロセスの ID 番号を含みます。この ID 番号は、ホスト・オペレーティング・システムの実際のプロセス ID (PID) です。ID 番号は、各プロセスに対して一意のものです。
The format of the string returned to $JOB is determined for the current process by the setting of the NodeNameInPid()Opens in a new tab method of the %SYSTEM.ProcessOpens in a new tab class. The system-wide default behavior can be established by setting the NodeNameInPidOpens in a new tab property of the Config.MiscellaneousOpens in a new tab class. 既定では、$JOB は PID のみを返しますが、ユーザは $JOB が PID とノード名の両方を返すようにこれらの関数を設定できます。(例) 11284:MYCOMPUTER。
この特殊変数は、SET コマンドを使用して変更することはできません。変更を試みると、<SYNTAX> エラーが返されます。
To establish the PID as the terminal prompt, use the TerminalPrompt(5)Opens in a new tab method of the %SYSTEM.ProcessOpens in a new tab class.
現在のプロセスに関するその他の情報
You can obtain the same current process ID number by invoking the ProcessId()Opens in a new tab method, as follows:
WRITE $SYSTEM.SYS.ProcessID()
詳細は、"インターシステムズ・クラス・リファレンス" の "%SYSTEM.SYSOpens in a new tab" クラスを参照してください。
$JOB を使用すると、次のように現在のプロセスのジョブ番号を取得することができます。
SET JobObj=##class(%SYS.ProcessQuery).%OpenId($JOB)
WRITE JobObj.JobNumber
詳細は、"インターシステムズ・クラス・リファレンス" の "%SYS.ProcessQueryOpens in a new tab" クラスを参照してください。
現在のプロセスに関する状況情報は、$ZJOB 特殊変数から取得することができます。
現在のプロセスの子プロセスまたは親プロセスの PID は、$ZCHILD および $ZPARENT 特殊変数から取得することができます。
ジョブ・テーブル内の現在のジョブの PID は、^$JOB 構造化システム変数から取得することができます。
関連項目
-
JOB コマンド