source: WorldVistAEHR/trunk/r/VA_FILEMAN-ARJT-DI-DD-DM-DT-%DT-%RCR/DIK.m@ 1211

Last change on this file since 1211 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 5.8 KB
Line 
1DIK ;SFISC/GFT,YJK,XAK-GATHER A FILE'S XREFS TO EXECUTE ;11:57 AM 6 May 2002
2 ;;22.0;VA FileMan;**41,109**;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 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
5 N DIKJ,DIKS,DIKZ1,DIN,DH,DU,DV,DW,DIKDA,DIAU,DIKALLR
6 D CHKS I $D(DIKZ1) N DIKIL S DIKIL=1 G @DIKGP
7 S X=2 D DD G ^DIK1
8 ;
9DD1 D D,A Q
10 ;
11DD D DIKJ N DIKCHK S DIKCHK=1,DV=0 D D,A
12 I $G(DIK(0))["s" S DU=1 Q
13E S DV=$O(^DD(DH,"SB",DV))
14 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
15 Q:$D(DIK0)
16DH S DH=$O(DU(DH)) G:DH>0 DH:$D(DV(DH)),E
17 F DH=DH(1):0 S DH=$O(DU(DH)) Q:DH'>0 D D,A
18DV 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")=""
19 S DU=1
20 Q
21 ;
22DW I $O(^UTILITY("DIK",DIKJ,DH,DV,0))="" K ^UTILITY("DIK",DIKJ,DH,DV)
23D S DV=$O(^DD(DH,"IX",DV)) Q:DV'>0 I '$D(^DD(DH,DV,0)) K ^DD(DH,"IX",DV) G D
24 D 0
25I 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
26 G DW
27INX I %["TRIGGER" S %=^(X),^UTILITY("DIK",DIKJ,DH,DV,DW)="D RCR",^(DW,0)=% Q
28 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
29 I '$D(DIK0),X=2,$P(%,U),$P(%,U,2)]"",$P(%,U,3)="",+%=DH(1)&$G(DIKALLR)!$D(DU(+%)) D
30 . S ^UTILITY("DIK",DIKJ,"KW",+%,$P(%,U,2))=DH_U_DV_U_DW
31 . D CHK($G(DU(+%)),.DU,.DIKCHK)
32 E D
33 . S ^UTILITY("DIK",DIKJ,DH,DV,DW)=^DD(DH,DV,1,DW,X)
34 . D CHK(DH,.DU,.DIKCHK)
35 Q
36CHK(F,DU,DIKCHK) ;Set CHK(f) for file F and its parents
37 Q:$D(DIK0)!'$G(DIKCHK)
38 F Q:'F Q:$D(DIKCHK(F)) S DIKCHK(F)=1,F=$G(DU(F))
39 Q
40A F DV=0:0 S DV=$O(^DD(DH,"AUDIT",DV)) Q:DV'>0 D A1
41 Q
42A1 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
430 ;
44 S DW=$P(^DD(DH,DV,0),U,4),^UTILITY("DIK",DIKJ,DH,DV)=$P(DW,";",1),DW=$P(DW,";",2)
45 S ^UTILITY("DIK",DIKJ,DH,DV,0)=$S(DW:"S X=$P(^(X),U,"_DW_")",1:"S X=$E(^(X),"_+$E(DW,2,9)_","_$P(DW,",",2)_")"),DW=0 Q
46 ;
47IX ;
48 N DIKJ,DIKS,DIKZ1,DIN,DH,DU,DV,DW,DIKDA,DIKALLR
49 D CHKS I $D(DIKZ1) N DIKKS S DIKKS=1 G @DIKGP
50 S X=2,DIKNM=1 D DD,1^DIK1
51IX1 ;
52 N DIKJ,DIKS,DIKZ1,DIN,DH,DU,DV,DW,DIKDA,DIKSET,DIKALLR
53 I '$D(DIKNM) D CHKS I $D(DIKZ1) N DIKST S DIKST=1 G @DIKGP
54 S X=1,DIKSET=1 D DD,1^DIK1
55 ;
56 D INDEX^DIKC(DIK,.DA,"","",$E("K",$D(DIKNM)#2)_"S"_$E("RI",$D(DIFROM)#2+1)_$E("s",$G(DIK(0))["s"))
57 G Q
58 ;
59IX2 ;
60 Q:$D(@(DIK_"0)"))[0
61 N DIKJ,DIKS,DIN,DH,DU,DV,DW,DIKDA,DIKALLR
62 S X=2 D DD,1^DIK1
63 D INDEX^DIKC(DIK,.DA,"","","K"_$E("RI",$D(DIFROM)#2+1)_$E("s",$G(DIK(0))["s"))
64 G Q
65 ;
66IXALL ;
67 N DIKJ,DIKS,DIKZ1,DIN,DH,DU,DV,DW,DIKDA,DIKSET,DIKALLR
68 D CHKS I $D(DIKZ1) N DIKSAT S DIKSAT=1,DA=0 G @DIKGP
69 ;
70 N DIKDASV,DIKSAVE
71 M DIKDASV=DA S DIKDASV=0,DIKSAVE=DIK
72 S (DA,DCNT)=0,X=1,DIKSET=1 D DD,CNT^DIK1
73 ;
74 D INDEX^DIKC(DIKSAVE,.DIKDASV,"","","S"_$E("RI",$D(DIFROM)#2+1)_$E("s",$G(DIK(0))["s"))
75 G Q
76 ;
77IXALL2 ;
78 Q:$D(@(DIK_"0)"))[0
79 N DIKJ,DIKS,DIN,DH,DU,DV,DW,DIKDA,DIKDASV,DIKSAVE,DIKALLR
80 M DIKDASV=DA S DIKDASV=0,DIKSAVE=DIK
81 S DIKALLR=1,(DA,DCNT)=0,X=2 D DD,CNT^DIK1
82 ;
83 D INDEX^DIKC(DIKSAVE,.DIKDASV,"","","K"_$E("RI",$D(DIFROM)#2+1)_$E("s",$G(DIK(0))["s"))
84 G Q
85 ;
86EN ;
87 N DIKCRFIL,DIKCDIK,DIKJ,DIKS,DIKZ1,DIN,DH,DU,DV,DW,DIKDA,DIKALLR
88 D N G:'$D(DH)!'$D(DA) Q
89 S DIKCRFIL=DH M DIKCDIK=DIK
90 S DIKNM=1,X=2 D:$D(DIKNX) PR,1^DIK1
91 ;
92EN1 ;
93 N DIKJ,DIKS,DIKZ1,DIN,DH,DU,DV,DW,DIKDA,DIKALLR
94 D @$S('$D(DIKNM):"N",1:"DIKJ") G:'$D(DH)!'$D(DA) Q
95 I '$D(DIKNM) N DIKCRFIL,DIKCDIK S DIKCRFIL=DH M DIKCDIK=DIK
96 S X=1 D:$D(DIKNX) PR,1^DIK1
97 I $D(^DD("IX","AC",DIKCRFIL)) M DIK=DIKCDIK D INDEX^DIKC(DIKCRFIL,.DA,$P(DIK(1),U),$P(DIK(1),U,2,999),$E("K",$D(DIKNM))_"S"_$E("RI",$D(DIFROM)#2+1))
98 G Q
99 ;
100EN2 ;
101 N DIKCRFIL,DIKCDIK,DIKJ,DIKS,DIKZ1,DIN,DH,DU,DV,DW,DIKDA,DIKALLR
102 D N G:'$D(DH)!'$D(DA) Q
103 S DIKCRFIL=DH M DIKCDIK=DIK
104 S X=2 D:$D(DIKNX) PR,1^DIK1
105 I $D(^DD("IX","AC",DIKCRFIL)) M DIK=DIKCDIK D INDEX^DIKC(DIKCRFIL,.DA,$P(DIK(1),U),$P(DIK(1),U,2,999),"K"_$E("RI",$D(DIFROM)#2+1))
106 G Q
107 ;
108ENALL ;
109 N DIKJ,DIKS,DIKZ1,DIN,DH,DU,DV,DW,DIKDA,DIKXREF,DIKDASV,DIKSAVE,DHSAVE,DIKALLR
110 D N G:'$D(DH) Q
111 M DIKDASV=DA,DIKSAVE=DIK,DHSAVE=DH S DIKDASV=0
112 S (DA,DCNT)=0,X=1 D PR,CNT^DIK1
113 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))
114 G Q
115 ;
116ENALL2 ;
117 N DIKJ,DIKS,DIKZ1,DIN,DH,DU,DV,DW,DIKDA,DIKXREF,DIKDASV,DIKSAVE,DHSAVE,DIKALLR
118 D N G:'$D(DH) Q
119 M DIKDASV=DA,DIKSAVE=DIK,DHSAVE=DH S DIKDASV=0
120 S DIKALLR=1,(DA,DCNT)=0,X=2 D PR,CNT^DIK1
121 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))
122 G Q
123 ;
124 ;
125N Q:'$D(DIK)!'$D(DIK(1))!'$D(@(DIK_"0)")) D DIKJ S DIKND=$P(DIK(1),U)
126 I '$D(^DD(DH,"IX",DIKND)) K:'$D(^DD("IX","F",DH,DIKND)) DH Q
127 I $P(DIK(1),U,2)="" D
128 . S %=0 F A1=1:1 S %=$O(^DD(DH,DIKND,1,%)) Q:'% S DIKNX(A1)=%
129 E F A1=1:1 Q:$P(DIK(1),U,A1+1)="" S DIKNX(A1)=$P(DIK(1),U,A1+1)
130 K A1,% Q
131 ;
132PR S DV=DIKND I '$D(^DD(DH,"IX",DV)),'$D(^DD(DH,"AUDIT",DV)) Q
133 D 0 S DIKZ1=1 D CK K DIKZ1
134 D:$D(^DD(DH,"AUDIT",DV)) A1 S DU=1 Q
135 ;
136CK Q:'$D(DIKNX(DIKZ1))
137 F DW=0:0 S DW=$O(^DD(DH,DV,1,DW)) Q:DW'>0 I $D(^(DW,0)),(DW=DIKNX(DIKZ1))!($P(^(0),U,2)=DIKNX(DIKZ1)),$D(^(X)),"Q"'[^(X) S %=^(0) D INX
138 S DIKZ1=DIKZ1+1 G CK
139 ;
140FREE(X) N V S V=$G(^UTILITY("DIK",X)) I 'V Q 1
141 Q $H-1>V
142 ;
143DIKJ F DIKJ=$J:.01 I $$FREE(DIKJ) K ^UTILITY("DIK",DIKJ) S ^UTILITY("DIK",DIKJ)=$H Q
144INT K DIKS,DIN,DH,DU,DV,DW S U="^",DH=+$P(@(DIK_"0)"),U,2),DH(1)=DH Q
145CHKS ;
146 I $D(@(DIK_"0)"))[0 S DIKZ1=1,DIKGP="Q^DIK1" Q
147 S DIKZ1=+$P(^(0),"^",2) I DIKZ1,$D(^DD(DIKZ1,0,"DIK")),$$ROUEXIST^DILIBF(^("DIK")) S DIKGP="^"_^DD(DIKZ1,0,"DIK") Q
148 K DIKZ1 Q
149 ;
150Q K DIKND,DIKNX,DIKZ1,DIKNM,DIAU,DIG,DIH,DIV,DIW,%,DH Q
Note: See TracBrowser for help on using the repository browser.