☜ | $NAMEM[UMPS] by Example | ☞ |
Introduced in the 1995 ANSI M[UMPS] language standard.
This function returns the ‘canonic representation’ of the name of the variable that is passed as a parameter.
Set ^ABC(1,2)="Define naked indicator"
Reference | Value | |
---|---|---|
$NAme(^(3,4)) | "^ABC(1,3,4)" | |
$NAme(^X(123+456_" apples")) | "^X(""579 apples"")" |
Set X="^ABC(11,22,33,44)"
Reference | Value | |
---|---|---|
$NAme(@X) | "^ABC(11,22,33,44)" | |
$NAme(@X,0) | "^ABC" | |
$NAme(@X,1) | "^ABC(11)" | |
$NAme(@X,3) | "^ABC(11,22,33)" | |
$NAme(@X,9) | "^ABC(11,22,33,44)" | |
$NAme(@X,–1) | Error (M39) | |
$NAme(X,1) | "X" | |
$NAme(^A(3,"A",4+3)) | "^A(3,""A"",7)" | |
$NAme(^A(3,"A",7),2) | "^A(3,""A"")" | |
$NAme(^A(3,4,5),0) | "^A" | |
$NAme(^A(1,2,3,4),8) | "^A(1,2,3,4)" | |
$NAme(^A) | "^A" | |
$NAme(^A(1,2,3,4),–1) | error (M39) |
Set X=^A(1,2,3)
Reference | Value | |
---|---|---|
$NAme(^(4,5)) | "^A(1,2,4,5)" |
The application of the functions $NAme, $QLength and $QSubscript is tightly coupled, which can be seen in the following example.
Note that this function merely operates on the name of a variable. The variable that is identified by this name is never accessed by this function. Therefore, this function only affects the naked indicator if a global variable needs to be accessed to evaluate the reference to the name in question.
So:
Set x=$Get(^two(1))
Write $NAme(^one(2))," ",$NAme(^(3))
will produce
^one(2) ^two(3)
The routine below scans a structure and totals the information stored at the various levels of this structure into an array.
Set START=$NAme(^SOMENAME(SOME,ARBITRARY,DEPTH))
Set STORE=$NAme(TOTALS)
Do SCAN(START,STORE)
;...
SCAN(START,TOT) ;
New G,HEAD,MAJOR,MINOR,SS1,SS2
Set HEAD=$QLength(START)
Set MAJOR=HEAD+1,MINOR=HEAD+2
Kill @TOT
Set G=START
For Set G=$Query(@G)
Quit:$NAme(@G,HEAD)'=START Do
. Set SS1=$QSubscript(G,MAJOR)
. If $QLength(G)=MAJOR Set @TOT@(SS1)=@G Quit
. Set SS2=$QSubscript(G,MINOR)
. Set @TOT@(SS1,SS2)=$Get(@TOT@(SS1,SS2))+@G
. Quit
Quit
The return value of $NAme contains an environment specification if and only if the parameter value contains an environment specification.
Reference | Value | |
---|---|---|
$NAme(^|HERE|ABC) | "^|""PRD,MST""|ABC" | |
$NAme(^ABC) | "^ABC" |
The ‘canonic’ names of structured system variables are always fully spelled:
Reference | Value | |
---|---|---|
$NAme(^$C("M","COLLATE")) | ^$CHARACTER("M","COLLATE") | |
$NAme(^$Character("M","COLLATE")) | ^$CHARACTER("M","COLLATE") |
Examples with naked references:
$NAme(GLVN)
Set ^ABC(1,2)="reset naked indicator"
; naked indicator is now ^ABC(1,
Set ^(3,4)=$NAme(^(5,6))
; 1. fetch ^(5,6) = ^ABC(1,5,6)
(naked indicator is still ^ABC(1,)
; 2. store ^(3,4) = ^ABC(1,3,4)
; naked indicator is now: ^ABC(1,3,
$NAme(GLVN,SUB)
Set ^ABC(1,2)="reset naked indicator"
; naked indicator is now ^ABC(1,
Set ^(3,4)=$NAme(^(5,6),^(7,8))
; 1. fetch ^(5,6) = ^ABC(1,5,6)
(naked indicator is still ^ABC(1,)
; 2. fetch ^(7,8) = ^ABC(1,7,8)
; 3. store ^(3,4) = ^ABC(1,7,3,4)
; naked indicator is now: ^ABC(1,7,3,
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, 13:10:23.
For comments, contact Ed de Moel (demoel@jacquardsystems.com)