Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples

KILL

M[UMPS] by Example

Introduced in the 1977 ANSI M[UMPS] language standard.

Kill A,B,C,^A,^B,^C
Kill (A,B,C)

Note that Kill (A(1),B) is not allowed.

Additions in a future M[UMPS] language standard.

In addition to the previous indirection capabilities, the possibility to Kill (A,B,@C,D) with C equal to "P,Q,R" is included.

When the traditional Kill command removes information, it removes any value, and any descendants of the variables affected. The addition is that two new commands are introduced (see command KSubscripts and command KValue) that allow for a more selective removal of information.

 New
 Do SETUP
 KSubscripts A,B,C
 ; A should be unchanged
1 If $Data(A)'=1 Do ERROR(1)
 ; B(10) should have been deleted
2 If $Data(B)'=0 Do ERROR(2)
 ; Only C(11) should have been deleted
3 If $Data(C)'=1 Do ERROR(3)
 Do SETUP
 KValue A,B,C
 ; A should have been deleted
4 If $Data(A)'=0 Do ERROR(4)
 ;B should be unchanged
5 If $Data(B)'=10 Do ERROR(5)
 ; C should be deleted, C(11) should remain
6 If $Data(C)'=10 Do ERROR(6)
 Do SETUP
 KSubscripts (A,B)
 ; A should be unchanged
7 If $Data(A)'=1 Do ERROR(7)
 ; B(10) should be unaffected
8 If $Data(B)'=10 Do ERROR(8)
 ; Only C(11) should have been deleted
9 If $Data(C)'=1 Do ERROR(9)
 Do SETUP
 KValue (A,B)
 ; A should be unchanged
10 If $Data(A)'=1 Do ERROR(10)
 ; B(10) should be unchanged
11 If $Data(B)'=0 Do ERROR(11)
 ; Only C should have been deleted
12 If $Data(C)'=10 Do ERROR(12)
 Do SETUP
 Kill A,B
 ; A should have been deleted
13 If $Data(A)'=0 Do ERROR(13)
 ; B(10) should have been deleted
14 If $Data(B)'=0 Do ERROR(14)
 ; Both C and C(11) should be unaffected
15 If $Data(C)'=11 Do ERROR(15)
 Do SETUP
 Kill (A,B)
 ; A should be unaffected
16 If $Data(A)'=1 Do ERROR(16)
 ; B(10) should be unaffected
17 If $Data(B)'=10 Do ERROR(17)
 ; Both C and C(11) should have been deleted
18 If $Data(C)'=0 Do ERROR(18)
 Quit
SETUP Set A=1,B(10)=10,C=11,C(11)=11 Quit
ERROR(I) Write !,"Error in check # ",I
 Write !,$Text(@I)
 Quit

Examples with naked references:

Kill VARIABLE
Set ^ABC(1,2)="reset naked indicator"
; naked indicator is now ^ABC(1,
Kill ^(3,4)

; naked indicator is now: ^ABC(1,3,
; Actual reference is: ^ABC(1,3,4)

Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples

Copyright © Standard Documents; 1977-2024 MUMPS Development Committee;
Copyright © Examples: 1995-2024 Ed de Moel;
Copyright © Annotations: 2003-2008 Jacquard Systems Research
Copyright © Annotations: 2008-2024 Ed de Moel.

The information in this page is NOT authoritative and subject to be modified at any moment.
Please consult the appropriate (draft) language standard for an authoritative definition.

Some specifications are "approved for inclusion in a future standard". Note that the MUMPS Development Committee cannot guarantee that such future standards will indeed be published.

This page most recently updated on 15-Nov-2023, 14:44:03.

For comments, contact Ed de Moel (demoel@jacquardsystems.com)