$ZJOB contains a number in which each bit represents one particular aspect of the job’s status. $ZJOB returns an integer that consists of the total of the set status bits. For example, if $ZJOB = 5, this means that the 1 bit and the 4 bit are set.
To test individual $ZJOB bit settings, you can use the integer divide (\) and modulo (#) operators. For example, $ZJOB\x#2, where x is the bit number. The following table shows the layout of the bits (by bit positional value), their settings and meanings:
|1||1||Job started from the Terminal prompt.|
|0||Job started from a routine.|
|2||1||Job started by the JOB command.|
|0||Job started by signing on either at the Terminal prompt or from a routine.|
|4||1||<INTERRUPT> enabled. A CTRL-C can interrupt a running program. Refer to BREAK flag for details.|
|0||<INTERRUPT> disabled except for terminal lines for which <INTERRUPT> has been explicitly enabled by OPEN or USE commands.|
|8||1||<INTERRUPT> received and pending.|
|0||<INTERRUPT> not received. The value 8 is cleared by the OPEN and USE commands and by an error trap caused by a CTRL-C.|
|1024||1||Journaling is disabled regardless of other conditions.|
|0||Journaling is enabled for this job if other conditions indicate journaling.|
This special variable cannot be modified using the SET command. Attempting to do so results in a <SYNTAX> error.
The following example returns $ZJOB as an integer:
The following example returns each $ZJOB bit value:
WRITE " bit 1=",$ZJOB\1#2,! WRITE " bit 2=",$ZJOB\2#2,! WRITE " bit 4=",$ZJOB\4#2,! WRITE " bit 8=",$ZJOB\8#2,! WRITE "bit 1024=",$ZJOB\1024#2
Bit 1 can also be returned using $ZJOB#2.