On Dec 31, 2005, at 1:51 PM, Kevin Toppenberg wrote:
I found the following line in the file DIS.m
set @("(J(N),DK)=+$piece("_R_"0),U,2)"),R=$piece(^(0),U)
would this be the same thing?
set (J(N),DK)=+$piece(@(R_0)),U,2)
set R=$piece(^(0),U)
Thanks
Kevin
Obfuscated MUMPS at its best! Let's try adding some spaces (meaning
it is no longer legal MUMPS):
SET @ ( "J(N),DK) = +$PIECE(" _ R _ "0), U,2)" ) , R = $PIECE(^(0),U)
Basically, the string "(J(N),DK)=+$PIECE(" becomes the first part of
the argument to the SET command. Now, I don't know what R is, but it
fills the first slot in a $PIECE, and given that the 0 is being
tacked on, I'd guess it's an "open" global reference, like "^VA
(200,". Appending the next string, "0),U,2" just fills out the
command. In this case, you'd get
"+$PIECE(^VA(200,0),U,2)"
In other words, code to extract the second "^"-piece from the file's
0-node. Now, if you put these pieces together you get
"(J(N),DK)=+$PIECE(^VA(200,0,U,2)"
which is a complete argument to a set command. The @ operator just
takes this chunk of code and makes it the actual argument, as if
though the command were
SET (J(N),DK)=$PIECE(^VA(200,0,U,2)
The comma just introduces second argument, so it is as if though you
had executed
SET R=$PIECE(^(0),U)
separately. And, of course, the "naked" reference ^(0) just expands
to the previous global reference WITH a 0, so it is the same as
SET R=$PIECE(^VA(200,0),U)
Since the third argument to $PIECE defaults to 1, that just sets R to
the first "^"-piece.
I don't think your code
set (J(N),DK)=+$piece(@(R_0)),U,2)
works, and here's why: You need to dereference a string, that looks
like R_"0)", but you haven't quoted anything, so MUMPS will think
your extra parenthesis is there for grouping, and not part of the
command argument.
===
Gregory Woodhouse
[EMAIL PROTECTED]
"Prediction is difficult, especially of the future."
--Niels Bohr
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Hardhats-members mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hardhats-members