tags:

views:

39

answers:

1

Hello MUMPS Experts,

I am working on MUMPS in my recent project. I have query reagrding naked indicator.I am confused between routine and naked global reference. can anybody help me to understand diffrence between routine and naked indicator? syntaxes seems almost similar to naked indicator.

Thanks,

Tina

+2  A: 

I'm not sure I fully understand your question, but I suspect you're referring to the fact that both Routine and Global references start with a caret (^).

Routines use the caret to distinguish between the routine and a label within the current routine. For example:

D COMPUTATION         ; executes the COMPUTATION label in the current routine
D ^COMPUTATION        ; executes the COMPUTATION routine
D SUBCOMP^COMPUTATION ; executes the SUBCOMP label in the COMPUTATION routine.

For variables, the caret indicates it is a global variable and not a local variable. This is the case whether you use naked references or not (this is where more clarification on your question might be in order, since as I understand it the reference being naked makes no difference). The difference being, of course, with the naked reference you can drop the variable name, and all but the last subscript of the global. For example:

S ^MYGLOB(1,1)="one"
S ^MYGLOB(1,2)="two"

is equivalent to

S ^MYGLOB(1,1)="one"
S ^(2)="two" ;naked, ewww

All that said, I would strongly advise against using naked references. They are intended to save time when entering code from the command prompt, but are very dangerous in code that has to be maintained. For example if a reference to ^OTHERGLOB were inserted between the two lines of code above, ^(2) would now reference ^OTHERGLOB(2), not ^MYGLOB(1,2). Not to mention, it's a pain to read.

Rob Mosher
Thanks Rob.It helped me a lot.
Tina
+1 Great answer Rob!
Ravi Gummadi