Skip to content

ZWIthdraw

ZWIthdraw

The ZWITHDRAW command KILLs the data value for a variable name without affecting the nodes descended from that node.

The format of the ZWITHDRAW command is:

ZWI[THDRAW][:tvexpr] glvn
  • The optional truth-valued expression immediately following the command is a command postconditional that controls whether or not GT.M executes the command.
  • The global or local variable name identifies the variable for which ZWITHDRAW removes the data value.
  • An indirection operator and an expression atom evaluating to a list of one or more ZWITHDRAW arguments form a legal argument for a ZWITHDRAW.

ZWITHDRAW provides a tool to quickly restore a node to a state where it has descendants and no value– that is, where $DATA for that node will have a value of 10 – for the case where such a state has some control meaning. GT.M also provides the ZKILL command, with functionality identical to ZWITHDRAW.

Examples of ZWITHDRAW

Example:

Kill A
Set A="A",A(1)=1,A(1,1)=1
WRite $Data(A(1)),!
ZWIthdraw A(1)
WRite $D(A(1)),!
ZWRite A
Quit

produces the result:

11
10
A="A"
A(1,1)=1

This sets up local variables A and A(1) and A(1,1). It then deletes the data for A(1) with ZWITHDRAW. The ZWRITE command shows ZWITHDRAW KILLed A(1) but left A and A(1,1).