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

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

initial load of WorldVistAEHR

File size: 6.1 KB
Line 
1DIED ;SFISC/GFT,XAK-MAJOR INPUT PROCESSOR ;05:43 PM 2 Jan 2002
2 ;;22.0;VA FileMan;**4,21,11,59,96**;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4O D W W Y W:$X>48 !?9
5 I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
6 I Y]"" W "// " I 'DV,DV["I",$D(DE(DQ))#2 S X="" W " (No Editing)" Q
7TR Q:$P(DQ(DQ),U,2)["K"&(DUZ(0)'="@") R X:DTIME E S (DTOUT,X)=U W $C(7)
8 Q
9W I $P(DQ(DQ),U,2)["K"&(DUZ(0)'="@") Q
10 I $D(DIE("W")) X DIE("W") Q
11 W !?DL+DL-2,$P(DQ(DQ),U,1)_": " Q
12 ;
13DQ ;
14 S:$D(DTIME)[0 DTIME=300 S DQ=1 G B
15A K DQ(DQ) S DQ=DQ+1
16B S DIFLD=$S($D(DIFLD(DQ)):DIFLD(DQ),1:-1)
17 I '$D(DQ(DQ)) G E^DIE1:'$D(DQ(0,DQ)),BR^DIE0
18RE ;
19 S DIP=$P(DQ(DQ),U,1),DV=$P(DQ(DQ),U,2),DU=$P(DQ(DQ),U,3) G:DV["K"&(DUZ(0)'="@") A G PR:$D(DE(DQ)) D W,TR I $D(DTOUT) K DQ,DG G QY^DIE1
20N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:$P(DC,U,2)-DP(0),A
21RD G ^DIE0:X[U,^DIE2:X="@" I X?."?" G A:$D(DB(DQ)),^DIEQ ;MAC-1201-61253
22 I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DIP)) S X=^(DIP) I DV'["D",DV'["S" W " "_X
23T G M^DIE1:DV,^DIE3:DV["V",P:DV'["S" X:$D(^DD(DP,DIFLD,12.1)) ^(12.1) I X?.ANP D I 'DDER X:$D(DIC("S")) DIC("S") I W:'$D(DB(DQ)) " "_% G V
24SET .N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
25 .I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
26 .D ^DIR I 'DDER S %=Y(0),X=Y
27 K DDER G X
28P I DV["P" S DIC=U_DU,DIC(0)=$E("EN",$D(DB(DQ))+1)_"M"_$E("L",DV'["'") S:DIC(0)["L" DLAYGO=+$P(DV,"P",2) G AST:DV["*" D NOSCR S X=+Y,DIC=DIE G X:X<0
29 G V:DV'["N" I $L($P(X,"."))>24 K X G Z
30 I $P(DQ(DQ),U,5,99)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
31V S DIER=1 X $P(DQ(DQ),U,5,99) K DIER,YS
32Z K DIC("S"),DLAYGO I $D(X),X?.ANP,X'=U D LOADXR G:'$$KEYCHK UNIQFERR S DG($P(DQ(DQ),U,4))=X S:DV["d" ^DISV(DUZ,"DIE",DIP)=X G A
33X W:'$D(ZTQUEUED) $C(7) W:'$D(DDS)&'$D(ZTQUEUED) "??"
34 G B^DIE1
35 ;
36PR I $D(DE(DQ,0)) S Y=DE(DQ,0) G F:Y?1"/".E I $D(DE(DQ))=10 D Y:$E(Y,1)=U,O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
37 S DG=DV,Y=DE(DQ),X=DU I DG["O",$D(^DD(DP,DIFLD,2)) X ^(2) G S
38R I DG["P",@("$D(^"_X_"0))") S X=+$P(^(0),U,2) G S:'$D(^(Y,0)) S Y=$P(^(0),U,1),X=$P(^DD(X,.01,0),U,3),DG=$P(^(0),U,2) G R
39 I DG["V",+Y,$P(Y,";",2)["(",$D(@(U_$P(Y,";",2)_"0)")) S X=+$P(^(0),U,2) G S:'$D(^(+Y,0)) S Y=$P(^(0),U,1) I $D(^DD(+X,.01,0)) S DG=$P(^(0),U,2),X=$P(^(0),U,3) G R
40 X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";",1) S:%]"" Y=%
41S D O I $D(DTOUT) K DQ,DG G QY^DIE1
42 I X="" S X=DE(DQ) X:$D(DICATTZ) $P(DQ(DQ),U,5,99) G A:'DV,A:DC<2 G N^DIE1
43 G RD:DQ(DQ)'["DINUM" D E^DIE0 G RD:$D(X),PR
44 ;
45F S DB(DQ)=1,X=$E(Y,2,999),DH=$F(DQ(DQ),"%DT=""E") I DH S DQ(DQ)=$E(DQ(DQ),1,DH-2)_$E(DQ(DQ),DH,999)
46 I X?1"/".E S X=$E(X,2,999),DH=""
47 X:$E(X,1)=U $E(X,2,999) G:X="" A:'DV,A:'$P(DC,U,4),N^DIE1 I $D(DE(DQ))#2,DV["I"!(DQ(DQ)["DINUM") D E^DIE0
48 G X:'$D(X),RD:DH]"",RD:X="@",M^DIE1:DV,Z
49 ;
50Y X $E(Y,2,999) S Y=X I DV["D",Y?7N.NP X ^DD("DD")
51Q Q
52 ;
53AST ;G V:DV["'",AST^DIE9
54 I DV["'" D
55 . D SCRNL(.DICONT)
56 E D SCRL(.DICONT)
57 I DICONT="V" K DICONT G V:$D(DNM)[0,@("V^"_DNM)
58 I DICONT="X" K DICONT G X:$D(DNM)[0,@("X^"_DNM)
59 I DICONT="Z" K DICONT G Z:$D(DNM)[0,@("Z^"_DNM)
60 Q
61RW G RW^DIR2
62 ;
63LOADXR ;Load all index file xrefs for a field
64 Q:$D(DIETMP)[0
65 N FLIST,RLIST,OLD
66 ;
67 I $G(DICRREC)]"" N DP,DIFLD,DIIENS S OLD=DIU,DP=DIH,DIFLD=DIG,DIIENS=DICRIENS
68 E S OLD=$G(DE(DQ))
69 ;
70 ;Get field- and record-level xrefs
71 D LOADFLD^DIKC1(DP,DIFLD,"KS","",$NA(@DIETMP@("V")),"DIEFXREF",$NA(@DIETMP@("R")),.FLIST,.RLIST)
72 I FLIST="",RLIST="" Q
73 S:RLIST]"" @DIETMP@("R",DP,DIIENS)=DIE
74 ;
75 ;Save the old value of the field
76 S @DIETMP@("V",DP,DIIENS,DIFLD,"O")=OLD S:$D(^("F"))[0 ^("F")=OLD
77 I $G(DICRREC)="",$G(DE(DQ,0))?1"//".E S @DIETMP@("V",DP,DIIENS,DIFLD,"4/")=""
78 E K @DIETMP@("V",DP,DIIENS,DIFLD,"4/")
79 Q
80 ;
81KEYCHK() ;If this is a key field, return 0 if not unique.
82 N DIEKCHK
83 Q:$D(DIETMP)[0 1
84 Q:'$D(DIEFXREF) 1
85 Q:$G(DE(DQ,0))?1"//".E 1
86 S @DIETMP@("V",DP,DIIENS,DIFLD,"N")=X
87 S DIEKCHK=$$KEYCHK^DIKK2(DP,.DA,DIFLD,"DIEFXREF",DIIENS,"","N")
88 K @DIETMP@("V",DP,DIIENS,DIFLD,"N")
89 Q DIEKCHK
90 ;
91UNIQFERR ;The field is part of a key and is not unique
92 I '$D(ZTQUEUED),'$D(DDS) D
93 . W $C(7)_"??"
94 . W:'$D(DB(DQ)) !," Another entry already exists with this key value."
95 K DIEFXREF S ^("N")=@DIETMP@("V",DP,DIIENS,DIFLD,"O")
96 G B^DIE1
97 ;
98NKEY ;No value was assigned to this key field
99 I '$D(ZTQUEUED),'$D(DDS) W $C(7)_"?? Required key field"
100 G B^DIE1
101 ;
102NOSCR ;No screen
103 N DIXRL
104 D GETXRL(DP,DIFLD,+$P(DV,"P",2),.DIXRL)
105 I DV'["'",$G(DIXRL)]"",(U_DIXRL_U)'["^B^" S DIXRL=DIXRL_"^B"
106 D DIC($G(DIXRL))
107 Q
108 ;
109SCRNL(DICONT) ;Screen, No LAYGO allowed
110 N DIFRST,DILAST,DIXRL
111 K DICONT
112 ;
113 D GETXRL(DP,DIFLD,+$P(DV,"P",2),.DIXRL)
114 G:$G(DIXRL)="" EXIT
115 ;
116 D:$D(DNM)#2 @("D^"_DNM)
117 D PARSE($P(DQ(DQ),U,5,999),.DIFRST,.DILAST)
118 G:'$D(DIFRST) EXIT
119 ;
120 X DIFRST
121 D DIC(DIXRL) S X=+Y
122 X:Y>0 DILAST
123 S DICONT=$S('$D(X):"X",X<0:"X",1:"Z")
124 Q
125 ;
126SCRL(DICONT) ;Screen, LAYGO allowed
127 N DICALL,DICSS,DIFRST,DILAST,DIXRL
128 K DICONT
129 ;
130 D GETXRL(DP,DIFLD,+$P(DV,"P",2),.DIXRL)
131 D:$D(DNM) @("D^"_DNM)
132 D PARSE($P(DQ(DQ),U,5,999),.DIFRST,.DILAST)
133 G:'$D(DIFRST) EXIT
134 ;
135 K D X DIFRST I '$D(DIC("S")),$G(DIXRL)="" S DICONT="V" Q
136 S DICSS=$G(DIC("S"))
137 ;
138 I $G(DIXRL)="" S DIXRL=$G(D)
139 E S:(U_DIXRL_U)'["^B^" DIXRL=DIXRL_"^B"
140 D DIC($G(DIXRL))
141 S X=+Y
142 ;
143 I $P(Y,U,3) S Y=+Y X:$D(@(DIC_Y_",0)")) DICSS E D S DICONT="X" Q
144 . N DV,DU,DA
145 . S DA=Y,DIK=DIC D ^DIK
146 ;
147 X:Y>0 DILAST
148 S DICONT=$S('$D(X):"X",X<0:"X",1:"Z")
149 Q
150 ;
151EXIT ;Cleanup and set flag to continue by executing the input transform
152 K DIC("PTRIX")
153 S DICONT="V"
154 Q
155 ;
156DIC(D) ;Make the appropriate ^DIC call based on D
157 I $G(D)]"",$P(D,U,2)="" S DIC(0)=$TR(DIC(0),"M")
158 E S:DIC(0)'["M" DIC(0)="M"_DIC(0)
159 ;
160 I $P($G(D),U)="" D
161 . D ^DIC
162 E I $P(D,U,2)]"" D
163 . D MIX^DIC1
164 E D IX^DIC
165 K DIC("PTRIX")
166 Q
167 ;
168PARSE(IT,FRST,LAST) ;Parse input transform
169 N CALL,I
170 F CALL=" D ^DIC"," D IX^DIC"," D MIX^DIC1","" Q:IT[CALL
171 I CALL="" K FRST,LAST Q
172 S FRST=$P(IT,CALL),LAST=$P(IT,CALL_" ",2,999)
173 I FRST?.E1" " D S FRST=$E(FRST,1,I)
174 . F I=$L(FRST)-1:-1:0 Q:$E(FRST,I)'=" "
175 Q
176 ;
177GETXRL(FIL,FLD,PFIL,LIST) ;Get list of indexes from DIE("PTRIX")
178 K DIC("PTRIX"),LIST Q:'$D(DIE("PTRIX"))
179 M DIC("PTRIX")=DIE("PTRIX")
180 ;
181 S LIST=$G(DIE("PTRIX",FIL,FLD,PFIL))
182 K:LIST="" LIST
183 Q
Note: See TracBrowser for help on using the repository browser.