151 lines
5.8 KiB
Mathematica
151 lines
5.8 KiB
Mathematica
DIK ;SFISC/GFT,YJK,XAK-GATHER A FILE'S XREFS TO EXECUTE ;11:57 AM 6 May 2002
|
|
;;22.0;VA FileMan;**41,109**;Mar 30, 1999
|
|
;Per VHA Directive 10-93-142, this routine should not be modified.
|
|
Q:"(,"'[$E($RE(DIK)) Q:'$D(@(DIK_"DA)")) Q:$P($G(^DD($$GLO^DILIBF(DIK),0,"DI")),U,2)["Y"&'$D(DIOVRD)&'$G(DIFROM) Q:DA'>0
|
|
N DIKJ,DIKS,DIKZ1,DIN,DH,DU,DV,DW,DIKDA,DIAU,DIKALLR
|
|
D CHKS I $D(DIKZ1) N DIKIL S DIKIL=1 G @DIKGP
|
|
S X=2 D DD G ^DIK1
|
|
;
|
|
DD1 D D,A Q
|
|
;
|
|
DD D DIKJ N DIKCHK S DIKCHK=1,DV=0 D D,A
|
|
I $G(DIK(0))["s" S DU=1 Q
|
|
E S DV=$O(^DD(DH,"SB",DV))
|
|
I DV>0 S DU=$O(^(DV,0)) G E:'$D(^DD(DV,.01,0)),E:$P(^(0),U,2)["W" S DW=$P($P(^DD(DH,DU,0),U,4),";") S:+DW'=DW DW=""""_DW_"""" S DV(DH,DU)=DW,DV(DH,DU,0)=DV,DU(DV)=DH D:$D(DIK0) CRT^DIKZ2 G E
|
|
Q:$D(DIK0)
|
|
DH S DH=$O(DU(DH)) G:DH>0 DH:$D(DV(DH)),E
|
|
F DH=DH(1):0 S DH=$O(DU(DH)) Q:DH'>0 D D,A
|
|
DV S DH=0 F S DH=$O(DV(DH)) Q:'DH S DU=0 F S DU=$O(DV(DH,DU)) Q:'DU I $G(DIKCHK),'$G(DIKCHK(DV(DH,DU,0))) S DV(DH,DU,"NOLOOP")=""
|
|
S DU=1
|
|
Q
|
|
;
|
|
DW I $O(^UTILITY("DIK",DIKJ,DH,DV,0))="" K ^UTILITY("DIK",DIKJ,DH,DV)
|
|
D S DV=$O(^DD(DH,"IX",DV)) Q:DV'>0 I '$D(^DD(DH,DV,0)) K ^DD(DH,"IX",DV) G D
|
|
D 0
|
|
I F DW=0:0 S DW=$O(^DD(DH,DV,1,DW)) Q:DW'>0 I $D(^(DW,X)),"Q"'[^(X),$D(^(0)) S %=^(0) D INX
|
|
G DW
|
|
INX I %["TRIGGER" S %=^(X),^UTILITY("DIK",DIKJ,DH,DV,DW)="D RCR",^(DW,0)=% Q
|
|
I %["BULLETIN MESSAGE",$D(DIK(0)),DIK(0)["B" S %=$P("CREA^DELE",U,X)_"TE VALUE" W:$D(^(%)) !,"...('"_^(%)_"' BULLETIN WILL NOT BE TRIGGERED)..." Q
|
|
I '$D(DIK0),X=2,$P(%,U),$P(%,U,2)]"",$P(%,U,3)="",+%=DH(1)&$G(DIKALLR)!$D(DU(+%)) D
|
|
. S ^UTILITY("DIK",DIKJ,"KW",+%,$P(%,U,2))=DH_U_DV_U_DW
|
|
. D CHK($G(DU(+%)),.DU,.DIKCHK)
|
|
E D
|
|
. S ^UTILITY("DIK",DIKJ,DH,DV,DW)=^DD(DH,DV,1,DW,X)
|
|
. D CHK(DH,.DU,.DIKCHK)
|
|
Q
|
|
CHK(F,DU,DIKCHK) ;Set CHK(f) for file F and its parents
|
|
Q:$D(DIK0)!'$G(DIKCHK)
|
|
F Q:'F Q:$D(DIKCHK(F)) S DIKCHK(F)=1,F=$G(DU(F))
|
|
Q
|
|
A F DV=0:0 S DV=$O(^DD(DH,"AUDIT",DV)) Q:DV'>0 D A1
|
|
Q
|
|
A1 D 0 S ^UTILITY("DIK",DIKJ,DH,DV,99)="S DIIX="_(4-X)_" D:$G(DIK(0))'[""A"" AUDIT" D CHK(DH,.DU,.DIKCHK) Q
|
|
0 ;
|
|
S DW=$P(^DD(DH,DV,0),U,4),^UTILITY("DIK",DIKJ,DH,DV)=$P(DW,";",1),DW=$P(DW,";",2)
|
|
S ^UTILITY("DIK",DIKJ,DH,DV,0)=$S(DW:"S X=$P(^(X),U,"_DW_")",1:"S X=$E(^(X),"_+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DIKZ1,DIN,DH,DU,DV,DW,DIKDA,DIKXREF,DIKDASV,DIKSAVE,DHSAVE,DIKALLR
|
|
D N G:'$D(DH) Q
|
|
M DIKDASV=DA,DIKSAVE=DIK,DHSAVE=DH S DIKDASV=0
|
|
S (DA,DCNT)=0,X=1 D PR,CNT^DIK1
|
|
D:$D(^DD("IX","AC",DHSAVE)) INDEX^DIKC(DHSAVE,.DIKDASV,$P(DIKSAVE(1),U),$P(DIKSAVE(1),U,2,999),"S"_$E("RI",$D(DIFROM)#2+1))
|
|
G Q
|
|
;
|
|
ENALL2 ;
|
|
N DIKJ,DIKS,DIKZ1,DIN,DH,DU,DV,DW,DIKDA,DIKXREF,DIKDASV,DIKSAVE,DHSAVE,DIKALLR
|
|
D N G:'$D(DH) Q
|
|
M DIKDASV=DA,DIKSAVE=DIK,DHSAVE=DH S DIKDASV=0
|
|
S DIKALLR=1,(DA,DCNT)=0,X=2 D PR,CNT^DIK1
|
|
D:$D(^DD("IX","AC",DHSAVE)) INDEX^DIKC(DHSAVE,.DIKDASV,$P(DIKSAVE(1),U),$P(DIKSAVE(1),U,2,999),"K"_$E("RI",$D(DIFROM)#2+1))
|
|
G Q
|
|
;
|
|
;
|
|
N Q:'$D(DIK)!'$D(DIK(1))!'$D(@(DIK_"0)")) D DIKJ S DIKND=$P(DIK(1),U)
|
|
I '$D(^DD(DH,"IX",DIKND)) K:'$D(^DD("IX","F",DH,DIKND)) DH Q
|
|
I $P(DIK(1),U,2)="" D
|
|
. S %=0 F A1=1:1 S %=$O(^DD(DH,DIKND,1,%)) Q:'% S DIKNX(A1)=%
|
|
E F A1=1:1 Q:$P(DIK(1),U,A1+1)="" S DIKNX(A1)=$P(DIK(1),U,A1+1)
|
|
K A1,% Q
|
|
;
|
|
PR S DV=DIKND I '$D(^DD(DH,"IX",DV)),'$D(^DD(DH,"AUDIT",DV)) Q
|
|
D 0 S DIKZ1=1 D CK K DIKZ1
|
|
D:$D(^DD(DH,"AUDIT",DV)) A1 S DU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