Loads a routine into the current routine buffer.
||Optional A postconditional expression.
||Optional The routine to be loaded. If omitted, Caché loads a routine from the current device.
command loads an ObjectScript routine into the routine buffer. ZLOAD
has two forms:
command without an argument loads an ObjectScript routine from the current device into the routine buffer. To load a routine from a device, execute the following:
command to open the device.
command to make the device the current device.
command without arguments.
Line loading will continue until Caché reads a null string line (""). This loaded routine has no name until you file it with the ZSAVE
loads the specified (existing) routine into the routine buffer from the current namespace.
does an implicit argumentless ZREMOVE
when it loads the routine. That is, ZLOAD
deletes any routine previously loaded as it writes the loaded routine. You can use the $ZNAME
special variable to determine the currently loaded routine. When ZLOAD
loads a routine, it positions the line pointer at the beginning of the routine.
Once loaded, a routine remains the current one for the process until you load another routine explicitly, with a ZLOAD
command, or implicitly, with a DO
or a GOTO
As long as the routine is current, you can edit the routine (with ZINSERT
commands), display one or more lines with the ZPRINT
command, or return a single line with the $TEXT
You can only use the ZLOAD
command when you enter it from the programmer prompt or when you call it using an XECUTE
command or a $XECUTE
function. It should not be coded into the body of a routine because its operation would affect the execution of that routine. Specifying ZLOAD
in a routine results in a compile error. Any attempt to execute ZLOAD
from within a routine also generates an error.
An optional postconditional expression. Caché executes the command if the postconditional expression is true (evaluates to a nonzero numeric value). Caché does not execute the command if the postconditional expression is false (evaluates to zero). For further details, refer to Command Postconditional Expressions
in Using Caché ObjectScript
The name of the routine to be loaded. Routine names are case-sensitive. If the specified routine does not exist, the system generates a <NOROUTINE> error.
You must have execute permission for routine
to be able to ZLOAD
it. If you do not have this permission, Cache generates a <PROTECT> error.
successfully loads routine
, all subsequent errors append the name of the currently loaded routine. This occurs whether or not the error has any connection to the routine, and occurs across namespaces. For further details, refer to the $ZERROR
The following Terminal example loads the routine ROUT, saved on disk:
The following Terminal example loads the first routine from the device dev
If you specify routine
, Caché looks for the routine in the pool of routine buffers in memory. If the routine is not there, Caché loads the ObjectScript object code version of the routine into one of the buffers. The ObjectScript source (intermediate) code remains in the ^ROUTINE global of the current namespace, but is updated if you make edits and save the changes.
For example, ZLOAD Test
loads the object code version of the routine Test (if it is not already loaded). You can view and edit the contents of the ^ROUTINE global using the Management Portal
. Select System Explorer
, then select the current namespace from the drop-down list of namespaces in the left-hand column.
If you omit routine
, Caché loads new lines of code that you enter from the current device, usually the keyboard until you terminate the code by entering a null line (that is, just press <Return>). This routine has no name until you save it with a subsequent ZSAVE
ZLOAD and Language Modes
When a routine is loaded, the current language mode changes to the loaded routine’s language mode. At the conclusion of called routines, the language mode is restored to the language mode of the calling routine. However, at the conclusion of a routine loaded with ZLOAD
the language mode is not restored to the previous language mode. For further details on checking and setting language modes, refer to the LanguageMode()
method of the %SYSTEM.Process
© 1997-2019 InterSystems Corporation, Cambridge, MA