Skip to main content

ZKILL (ObjectScript)

Deletes a node while preserving the node’s descendants.

Synopsis

ZKILL:pc array-node,...
ZK:pc array-node,...

Arguments

Argument Description
pc Optional — A postconditional expression.
array-node A local variable, a process-private global, or a global that is an array node, or a comma-separated list of local, process-private global, or global array nodes.

Description

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 global, or a global variable.

By default, any subsequent reference to this killed array-node generates an <UNDEFINED> error. You can change InterSystems IRIS behavior to not generate an <UNDEFINED> error when referencing an undefined subscripted variable by setting the %SYSTEM.Process.Undefined()Opens in a new tab method.

Arguments

pc

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.

array-node

A local variable, 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 Formal Rules about Globals.

Attempting to use ZKILL on a structured system variable (SSVN) (such as ^$GLOBAL) results in a <COMMAND> error.

Example

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:

   WRITE a(1)

generates an <UNDEFINED> error.

See Also

FeedbackOpens in a new tab