It sounds like you've already got it figured out. In MUMPS, "@" is the dereference operator and, in this case, $T is $TEXT, so the code iterates through file 9.8, looking at the second piece of the 0-node. If that string is "R", it expects the first node (i.e., the .01 field to be a routine name), so it takes that string prepended with "^" and attempts to fetch the first line. If nothing is there, then it assumes that the record with DA as its internal entry number is no longer valid and calls ^DIK to delete it.

Clever code. Of course, clever code isn't necessarily transparent code, which is one reason you often see "cleverness" discouraged. The problem, of course, is that a $DATA of ^$ROUTINE, a much more transparent solution, would not work on all MUMPS implementations. Small differences like this are a perennial problem with MUMPS (and a big reason why this type of code is required to be encapsulated within the infrastructure packages of VistA).

===
Gregory Woodhouse
[EMAIL PROTECTED]

"Nothing is as powerful than an idea
whose time has come."
-- Victor Hugo


On Aug 14, 2005, at 6:30 PM, Kevin Toppenberg wrote:

OK.  Thanks

Here is the code that gets executed if one answers YES, and to my
unpracticed eye, it seems to delete all records in file 9.8 that have
field TYPE="R".

N DA,DIK,Y
    S DIK="^DIC(9.8,",DA=0
    F  S DA=$O(^DIC(9.8,DA)) Q:'DA  S Y=$G(^(DA,0)) I
$P(Y,U,2)="R",$T([EMAIL PROTECTED](Y,U))="" D ^DIK
    Q

I don't understand the $T([EMAIL PROTECTED](Y,U))=""  part, though.  Let me try 
to
pick through this...
Y=node 0 of record
$p(Y,U) should return first part of the node, which is the .01 field
and example entry would be the name of one of the routines, e.g. DICA
so $T(^DICA) would then return first line of file...

ah-haa, so it is NOT all files that killed, only those that that have
a null first line (i.e. the routine doesn't exist...)

Mystery solved.
Thanks
Kevin




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Hardhats-members mailing list
Hardhats-members@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hardhats-members

Reply via email to