43 lines
1.6 KiB
Mathematica
43 lines
1.6 KiB
Mathematica
DIQGU0 ;SFISC/DCL-DATA RETRIVIAL UTILITY PROGRAM ;02:42 PM 24 Aug 1993
|
|
;;22.0;VA FileMan;;Mar 30, 1999
|
|
;Per VHA Directive 10-93-142, this routine should not be modified.
|
|
R(%R) ;
|
|
N %C,%F,%G,%I,%R1,%R2
|
|
S %R1=$P(%R,"(")_"(" I $E(%R1)="^" S %R2=$P($Q(@(%R1_""""")")),"(")_"(" S:$P(%R2,"(")]"" %R1=%R2
|
|
S %R2=$P($E(%R,1,($L(%R)-($E(%R,$L(%R))=")"))),"(",2,99)
|
|
S %C=$L(%R2,","),%F=1 F %I=1:1:%C S %G=$P(%R2,",",%F,%I) Q:%G="" I ($L(%G,"(")=$L(%G,")")&($L(%G,"""")#2))!(($L(%G,"""")#2)&($E(%G)="""")&($E(%G,$L(%G))="""")) S %G=$$S(%G),$P(%R2,",",%F,%I)=%G,%F=%F+$L(%G,","),%I=%F-1
|
|
Q %R1_%R2
|
|
S(%Z) ;
|
|
I $G(%Z)']"" Q ""
|
|
I $E(%Z)'="""",$L(%Z,"E")=2,+$P(%Z,"E")=$P(%Z,"E"),+$P(%Z,"E",2)=$P(%Z,"E",2) Q +%Z
|
|
I +%Z=%Z Q %Z
|
|
I %Z="""""" Q ""
|
|
I $E(%Z)'?1A,"%$+@"'[$E(%Z) Q %Z
|
|
I "+$"[$E(%Z) X "S %Z="_%Z Q $$Q(%Z)
|
|
I $D(@%Z) Q $$Q(@%Z)
|
|
Q %Z
|
|
Q(%Z) ;
|
|
S %Z(%Z)="",%Z=$Q(%Z("")) Q $E(%Z,4,$L(%Z)-1)
|
|
DDLST(DDN,ATRN,FL) ;
|
|
N X,Y S:$D(^DD(DDN)) ATRN(DDN)="" S FL=+$G(FL)
|
|
D S X=0 F S X=$O(^DD(DDN,"SB",X)) Q:X'>0 S ATRN(X)="" D D DDLST(X,.ATRN,FL)
|
|
.I 'FL S Y="" F S Y=$O(^DD(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