Loads a routine into the current routine buffer.
||Optional A postconditional expression.
||Optional The routine to be loaded. If omitted, InterSystems IRIS loads a routine from the current device.
command loads an ObjectScript routine into the routine buffer. ZLOAD
has two forms:
ZLOAD without an Argument
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 InterSystems IRIS 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 Terminal 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. InterSystems IRIS executes the command if the postconditional expression is true (evaluates to a nonzero numeric value). InterSystems IRIS does not execute the command if the postconditional expression is false (evaluates to zero). For further details, refer to Command Postconditional Expressions
in Using 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, InterSystems IRIS 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
Routine Behavior with ZLOAD
If you specify routine
, InterSystems IRIS looks for the routine in the pool of routine buffers in memory. If the routine is not there, InterSystems IRIS 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
, InterSystems IRIS 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
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
Content Date/Time: 2019-02-21 01:13:32