Caché ObjectScript Reference
[Back] [Next]
Go to:

Contains the ID of the last child process.
$ZCHILD contains the ID of the last child process that the current process created with the JOB command. If your process has not used JOB to create a child process, $ZCHILD returns 0 (zero).
In MSM language mode, the $ZC special variable (spelled as shown) has a different use. It is used for determining end-of-file in sequential file reads.
This special variable cannot be modified using the SET command. Attempting to do so results in a <SYNTAX> error.
$ZCHILD and the Successful Starting of Jobs
$ZCHILD being set does not mean that the job was successfully started. It only means that the process was created and the parameters were passed successfully.
For example, if you use JOB to spawn a routine that does not exist, both $TEST and $ZCHILD report that the JOB command succeeded, although that new job immediately dies with a <NOROUTINE> error.
$ZC in MSM Language Mode
MSM language mode supports a special use of the $ZC special variable.
If you have set the current language mode to MSM using the LanguageMode(8) method of the %SYSTEM.Process class, the $ZC special variable is set during sequential file reads. This provides compatibility with the MSM $ZC variable. (In all other language modes, $ZC is not set during file reads; $ZC is an abbreviation for $ZCHILD and has a completely different functionality.)
In MSM language mode, a successful sequential file read sets $ZC=0.
In MSM language mode, an end-of-file condition sets $ZC=–1 (negative 1). An <ENDOFFILE> error does not occur.
However, Caché $ZC is not identical to the MSM $ZC:
MSM sets its $ZC=–1 (negative 1) if the last line of the file is not terminated with the delimiter character(s). Caché does not check for delimiter characters; it sets $ZC=0 instead of –1 in this case.
MSM sets its $ZC=1 if an I/O error occurs during a read. Caché does not support this functionality; instead, Caché issues a <READ> error.
See Also
Child processes:
MSM language mode: