Job

The JOB Environment
JOB Processparameters
Examples of JOB

The JOB command creates another process, activates the current image or another specified GT.M executable image, and executes a named routine.

$ZJOB is set to the pid of the process created by the JOB command. For details refer to the "$ZJOB" section in the "Intrinsic Special Variable" chapter of GT.M Programmer's Guide.

The format of the JOB command is:

        J[OB][:tvexpr] entryref[(expr[,...])]
        [:[(keyword[=value][:...])][:numexpr]][,...]
      

The resultant process can be detached or spawned. VMS deletes the resultant process when the image completes execution. If the job is spawned, VMS deletes the image when the parent process terminates. A detached job can continue after the parent process terminates.

By default, the new process uses the same base image as the parent process. The IMAGE processparameter specifies an alternative image. If the routine specified by the entryref is not in the linked image, the created process attempts to auto-ZLINK the missing routine. For more information on entryrefs, refer to the "General Language Features of M" chapter in this manual.

If a JOB command specifies a timeout, and GT.M creates the resultant process before the timeout elapses, JOB sets $TEST to true (1). If GT.M cannot create the process within the specified timeout, JOB sets $TEST to false (0). If a JOB command does not specify a timeout, the execution of the command does not affect $TEST.

If GT.M cannot create the process because of something that is unlikely to change during the timeout interval, such as insufficient privileges or failure to find the specified image, the JOB command generates a run-time error. If the command does not specify a timeout and the environment does not provide adequate resources, the process waits until resources become available to create the resultant process.

The resultant process executes asynchronously with the current process. Once GT.M starts the resultant process, the current process continues, regardless of whether the JOB is detached or spawned.