Reputation: 12289
I have a piece of mumps code
DO ENYA^PRCTQUES
and
DO ^PRCTQUES
I understand what the first one does. However, I don't know what the 2nd example does. What's it calling?
EDIT - What if the code at the top is all comments?
PRCTQUES ; comment
;;comment
; MOAR comment
;
So what are we doing here with DO ^PRCTQUES
? Just making sure the file exists and is compiled?
Finally what if my file started with the label ZOOT
?
ZOOT
(code)
Q
then what? Does DO ^PRCTQUES
invoke the ZOOT
label because it is at the top? Or do I get an error message? It looks like bad style of course...
Upvotes: 1
Views: 68
Reputation: 612
If you have a routine FOO that looks like this:
FOO ; Foo routine
WRITE "HELLO FOO",!
QUIT
LABEL ; A line label
WRITE "HELLO LABEL",!
QUIT
DO ^FOO
will show the output "HELLO FOO". DO LABEL^FOO
will show "HELLO LABEL".
So calling a routine without a label (as in DO ^PRCTQUES
) will execute the routine from the top. Otherwise, with a label DO ENYA^PRCTQUES
it will run the code starting from the label.
In your edited question, you asked about what happens if you have a routine PRCTQUES
with a label ZOOT
at the top. Like this:
ZOOT
WRITE "ZOOT",!
QUIT
In this case, DO ^PRCTQUES
will write ZOOT
. Also, DO ZOOT^PRCTQUES
will also write ZOOT
. However, because most companies consider it a bad practice that the first label in the routine isn't the routine name, so this is not an example you see in practice.
Upvotes: 3
Reputation: 4096
According to Wikipedia:
All variable names prefixed with the caret character (^) use permanent (instead of RAM) storage, will maintain their values after the application exits, and will be visible to (and modifiable by) other running applications.
https://en.m.wikipedia.org/wiki/MUMPS
Upvotes: 1