source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/OCXDI2.m@ 1607

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

initial load of FOIAVistA 6/30/08 version

File size: 5.8 KB
Line 
1OCXDI2 ;SLC/RJS,CLA - OCX PACKAGE DIAGNOSTIC UTILITY ROUTINE ;SEP 7,1999 at 10:30
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**32**;Dec 17,1997
3 ;; ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
4 ;
5S ;
6 ; Record Utilities
7 Q
8 ;
9ADDREC(OCXCREF) ;
10 ;
11 ;
12 N QUIT,OCXDD,OCXDA,OCXGREF,OCXNAME
13 S OCXDD=$O(@OCXCREF@("")) Q:'OCXDD 0
14 Q:'OCXFLGC 0
15 I (OCXFLGA) S QUIT=$$READ("Y"," Do you want to add a local '"_$$FILENAME^OCXBDTD(+OCXDD)_"' record ?","YES") Q:'QUIT (QUIT[U)
16 ;
17 S OCXDA=0 D CREATE(OCXCREF,OCXDD,.OCXDA,0)
18 S OCXNAME=$G(@OCXCREF@(OCXDD,.01,"E")) S:$L(OCXNAME) ^TMP("OCXDIAG",$J,"A",+OCXDD,OCXNAME)=""
19 ;
20 Q 0
21 ;
22DELREC(OCXFILE,OCXDA) ;
23 ;
24 ;
25 N QUIT
26 Q:'OCXFLGC 0 Q:$G(OCXAUTO) 0
27 I (OCXFLGA) S QUIT=$$READ("Y"," Do you want to delete the local '"_$$FILENAME^OCXBDTD(+OCXFILE)_"' record ?","YES") Q:'QUIT (QUIT[U)
28 ;
29 W !,OCXFILE," ",OCXDA
30 D DIE(OCXFILE,$$FILE^OCXBDTD(OCXFILE,"GLOBAL NAME"),.01,"@",OCXDA,0)
31 W !!," deleted..."
32 ;
33 Q 0
34 ;
35DELDUP(OCXFILE,OCXNAME) ;
36 ;
37 ;
38 N OCXQUIT,OCXCGL,OCXOGL,OCXD0,RESP,OCXKEY,KEYLEN,OCXKEEP
39 ;
40 I (OCXFLGR) W !," There are duplicate copies of the '"_$$FILENAME^OCXBDTD(+OCXFILE)_":"_OCXNAME_"' record."
41 I '$G(OCXAUTO),'OCXFLGC Q 0
42 I (OCXFLGA) S RESP=$$READ("Y"," Do you want to purge duplicate copies of the '"_$$FILENAME^OCXBDTD(+OCXFILE)_":"_OCXNAME_"' record ?","YES") Q:'RESP 0 Q:(RESP[U) -10
43 ;
44 S OCXOGL=$$FILE^OCXBDTD(OCXFILE,"GLOBAL NAME")
45 S OCXCGL=$$CREF^DILF(OCXOGL)
46 F KEYLEN=$L(OCXNAME):-1:1 S OCXKEY=$E(OCXNAME,1,KEYLEN) Q:$D(@OCXCGL@("B",OCXKEY))
47 S OCXD0=0 F S OCXD0=$O(@OCXCGL@("B",OCXKEY,OCXD0)) Q:'OCXD0 Q:($P($G(@OCXCGL@(OCXD0,0)),U,1)=OCXNAME)
48 W:OCXFLGR !,"Keep: ",OCXFILE," ",OCXNAME," ",OCXD0
49 S OCXKEEP=OCXD0 F S OCXD0=$O(@OCXCGL@("B",OCXKEY,OCXD0)) Q:'OCXD0 I ($P($G(@OCXCGL@(OCXD0,0)),U,1)=OCXNAME) D
50 .W:OCXFLGR !!,"Delete: ",OCXFILE," ",OCXNAME," ",OCXD0
51 .D DIE(OCXFILE,OCXOGL,.01,"@",OCXD0,0)
52 .W:OCXFLGR " deleted..."
53 ;
54 I ($P($G(@OCXCGL@(OCXKEEP,0)),U,1)=OCXNAME) S ^TMP("OCXDIAG",$J,"A",FILE,OCXNAME)=""
55 ;
56 Q OCXKEEP
57 ;
58CREATE(OCXCREF,OCXDD,OCXDA,OCXLVL) ;
59 ;
60 N OCXFLD,OCXGREF,OCXKEY
61 ;
62 S OCXKEY=@OCXCREF@(OCXDD,.01,"E")
63 S OCXGREF=$$GETREF(+OCXDD,.OCXDA,OCXLVL) Q:'$L(OCXGREF)
64 I 'OCXDA D
65 .S OCXDA=$O(^TMP("OCXDIAG",$J,"B",+OCXDD,OCXKEY,0)) Q:OCXDA
66 .S OCXDA=$O(@(OCXGREF_""" "")"),-1)+1
67 .F OCXDA=OCXDA:1 Q:'$D(@(OCXGREF_OCXDA_",0)"))
68 .I $D(@(OCXGREF_OCXDA_",0)")) S OCXDA=0
69 ;
70 I 'OCXDA W !!,"Error adding record..." Q
71 ;
72 I '$D(@(OCXGREF_"0)")) S @(OCXGREF_"0)")=U_$$FILEHDR^OCXBDTD(+OCXDD)_U_U
73 ;
74 S OCXFLD=0 F S OCXFLD=$O(@OCXCREF@(OCXDD,OCXFLD)) Q:'OCXFLD Q:(OCXFLD[":") I '$$EXFLD^OCXDI1(+OCXDD,OCXFLD) D
75 .I $L($G(@OCXCREF@(OCXDD,OCXFLD,"E"))) D DIE(OCXDD,OCXGREF,OCXFLD,@OCXCREF@(OCXDD,OCXFLD,"E"),.OCXDA,OCXLVL)
76 .I $O(@OCXCREF@(OCXDD,OCXFLD,0)) D WORD(OCXDD,OCXGREF,OCXFLD,.OCXDA,OCXCREF)
77 ;
78 D PUSH(.OCXDA)
79 S OCXFLD="" F S OCXFLD=$O(@OCXCREF@(OCXDD,OCXFLD)) Q:'$L(OCXFLD) I (OCXFLD[":") D
80 .S OCXDA=$P(OCXFLD,":",2) W:OCXFLGR ! D CREATE($$APPEND(OCXCREF,OCXDD),OCXFLD,.OCXDA,OCXLVL+1)
81 D POP(.OCXDA)
82 Q
83 ;
84LOADWORD(RREF,OCXDD,OCXFLD,OCXSUB) ;
85 ;
86 N QUIT,DDPATH,INDEX,OCXDA,OCXGREF
87 S DDPATH=$P($P($$APPEND(RREF,OCXDD),"(",2),")",1)
88 F INDEX=1:1:$L(DDPATH,",") S OCXDA($L(DDPATH,",")-INDEX)=+$P($P(DDPATH,",",INDEX),":",2)
89 S OCXDA=$G(OCXDA(0)) K OCXDA(0)
90 Q:'OCXFLGC 0 I OCXFLGA S QUIT=$$READ("Y"," Do you want to reload the local '"_$$FIELD^OCXBDTD(+OCXDD,+OCXFLD,"LABEL")_"' field ?","YES") Q:'QUIT (QUIT[U)
91 S OCXGREF=$$GETREF(+OCXDD,.OCXDA,$L(DDPATH,",")-1) Q:'$L(OCXGREF)
92 D WORD(OCXDD,OCXGREF,OCXFLD,.OCXDA,RREF)
93 Q 0
94 ;
95GETREF(OCXDD,OCXDA,OCXLVL) ;
96 ;
97 Q:'OCXDD ""
98 ;
99 N OCXIENS,OCXERR,OCXX
100 S OCXIENS=$$IENS^DILF(.OCXDA),OCXERR=""
101 S OCXX=$$ROOT^DILFD(OCXDD,OCXIENS,0,OCXERR)
102 Q OCXX
103 ;
104WORD(DD,GREF,FLD,DA,RREF) ;
105 ;
106 N SUB,GLROOT,LINE
107 S SUB=$P($$FIELD^OCXBDTD(+DD,FLD,"GLOBAL SUBSCRIPT LOCATION"),";",1) S:'(SUB=+SUB) SUB=""""_SUB_""""
108 S GLROOT=GREF_DA_","_SUB_")" K @GLROOT
109 S LINE=0 F S LINE=$O(@RREF@(DD,FLD,LINE)) Q:'LINE D
110 .S @GLROOT@($O(@GLROOT@(""),-1)+1,0)=@RREF@(DD,FLD,LINE)
111 S LINE=$O(@GLROOT@(""),-1),@GLROOT@(0)=U_U_LINE_U_LINE_U_$$DATE("T")_U
112 ;
113 Q
114 ;
115DATE(X) N %DT,Y S %DT="" D ^%DT Q +Y
116 ;
117DIE(OCXDD,OCXDIC,OCXFLD,OCXVAL,OCXDA,OCXLVL) ;
118 ;
119 N DIC,DIE,X,Y,DR,DA,OCXDVAL,OCXPTR,OCXGREF,D0
120 S (D0,DA)=OCXDA,(DIC,DIE)=OCXDIC,DR=""
121 S:OCXLVL D0=OCXDA(1),DR="S DA(1)="_(+D0)_",D0="_(+D0)_";"
122 S:OCXVAL="?" OCXVAL="? "
123 ;
124 I '(OCXVAL="@"),OCXFLGR W !,?(OCXLVL*5),$$FIELD^OCXBDTD(+OCXDD,OCXFLD,"LABEL"),": ",OCXVAL
125 ;
126 I '(OCXVAL="@") D
127 .N OCXIEN,SHORT
128 .S OCXPTR=+$P($$FIELD^OCXBDTD(+OCXDD,OCXFLD,"SPECIFIER"),"P",2)
129 .I 'OCXPTR S DR=DR_OCXFLD_"///^S X=OCXVAL" Q
130 .S OCXGREF="^"_$$FIELD^OCXBDTD(+OCXDD,OCXFLD,"POINTER")
131 .I '($E(OCXGREF,1,4)="^OCX"),'(OCXGREF="^ORD(100.9,"),'(OCXGREF="^ORD(100.8,") Q
132 .S OCXIEN=$$DIC(OCXGREF,OCXVAL,0)
133 .S:'OCXIEN OCXIEN=$$DIC(OCXGREF,OCXVAL,1),^TMP("OCXDIAG",$J,"B",OCXPTR,OCXVAL,OCXIEN)=""
134 .S DR=DR_OCXFLD_"///`"_(+OCXIEN)
135 ;
136 I (OCXVAL="@") S DR=DR_OCXFLD_"///^S X=OCXVAL"
137 S OCXSCR=1
138 D ^DIE
139 ;
140 ; I $D(Y) -> DIE FILER ERROR
141 ;
142 Q
143 ;
144DIC(DIC,X,OCXADD) S DIC(0)="MX",OCXSCR=1 S:OCXADD DIC(0)="MXL" D ^DIC Q:(+Y>0) +Y Q 0
145 ;
146PUSH(OCXDA) ;
147 N OCXSUB S OCXSUB="" F S OCXSUB=$O(OCXDA(OCXSUB),-1) Q:'OCXSUB S OCXDA(OCXSUB+1)=OCXDA(OCXSUB)
148 S OCXDA(1)=OCXDA,OCXDA=0
149 Q
150 ;
151POP(OCXDA) ;
152 N OCXSUB S OCXSUB="" F S OCXSUB=$O(OCXDA(OCXSUB)) Q:'OCXSUB S OCXDA(OCXSUB)=$G(OCXDA(OCXSUB+1))
153 S OCXDA=OCXDA(1) K OCXDA($O(OCXDA(""),-1))
154 Q
155 ;
156APPEND(ARRAY,OCXSUB) ;
157 S:'(OCXSUB=+OCXSUB) OCXSUB=""""_OCXSUB_""""
158 Q:'(ARRAY["(") ARRAY_"("_OCXSUB_")"
159 Q $E(ARRAY,1,$L(ARRAY)-1)_","_OCXSUB_")"
160 ;
161READ(OCXZ0,OCXZA,OCXZB,OCXZL) ;
162 N OCXLINE,DIR,DTOUT,DUOUT,DIRUT,DIROUT
163 Q:'$L($G(OCXZ0)) U
164 S DIR(0)=OCXZ0
165 S:$L($G(OCXZA)) DIR("A")=OCXZA
166 S:$L($G(OCXZB)) DIR("B")=OCXZB
167 F OCXLINE=1:1:($G(OCXZL)-1) W !
168 D ^DIR
169 I $D(DTOUT)!$D(DUOUT)!$D(DIRUT)!$D(DIROUT) Q U
170 Q Y
171 ;
172PAUSE() Q:'OCXFLGC 0 W " Press Enter " R X:DTIME W ! Q (X[U)
173 ;
Note: See TracBrowser for help on using the repository browser.