Caché ObjectScript Reference
ZKILL
|
|
Deletes a node while preserving the node’s descendants.
Synopsis
ZKILL:pc array-node,...
ZK:pc array-node,...
The
ZKILL command removes the value of a specified
array-node without killing that node’s descendants. In contrast, the
KILL command removes the value of a specified array node and all of that node’s descendants. An array node can be a local variable, a process-private variable, or a global variable.
By default, any subsequent reference to this killed
array-node generates an <UNDEFINED> error. You can change Caché behavior to not generate an <UNDEFINED> error when referencing an undefined subscripted variable by setting the
%SYSTEM.Process.Undefined() method.
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.
A local, process-private global, or global array node. You can specify a single array node, or a comma-separated list of array nodes. For further details on subscripts and nodes, refer to
Global Structure in
Using Caché Globals.
In this example, the
ZKILL command deletes node a(1), but does not remove node a(1,1).
SET a(1)=1,a(1,1)=11
SET x=a(1)
SET y=a(1,1)
ZKILL a(1)
SET z=a(1,1)
WRITE "x=",x," y=",y," z=",z
returns x=1 y=11 z=11. However, then issuing a:
generates an <UNDEFINED> error.