source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/OCXBDT4.m@ 619

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

initial load of WorldVistAEHR

File size: 5.3 KB
RevLine 
[613]1OCXBDT4 ;SLC/RJS,CLA - BUILD OCX PACKAGE DIAGNOSTIC ROUTINES (Build Runtime Library Routine OCXDI0) ;8/04/98 13:21
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**32**;Dec 17,1997
3 ;; ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
4 ;
5EN() ;
6 ;
7 N R,LINE,TEXT,NOW,RUCI,XCM
8 S NOW=$$NOW^OCXBDT3,RUCI=$$CUCI^OCXBDT
9 F LINE=1:1:999 S TEXT=$P($T(TEXT+LINE),";",2,999) Q:TEXT S TEXT=$P(TEXT,";",2,999) S R(LINE,0)=$$CONV^OCXBDT3(TEXT)
10 ;
11 M ^TMP("OCXBDT",$J,"RTN")=R
12 ;
13 S DIE="^TMP(""OCXBDT"","_$J_",""RTN"",",XCN=0,X="OCXDI0"
14 W !,X X ^%ZOSF("SAVE") W " ... ",XCM," Lines filed" K ^TMP("OCXBDT",$J,"RTN")
15 ;
16 Q XCM
17 ;
18TEXT ;
19 ;;OCXDI0 ;SLC/RJS,CLA - OCX PACKAGE DIAGNOSTIC UTILITY ROUTINE ;|NOW|
20 ;;|OCXLIN2|
21 ;;|OCXLIN3|
22 ;; ;
23 ;;S ;
24 ;; ;
25 ;; Q
26 ;; ;
27 ;;RTN(RSUM) ;
28 ;; ;
29 ;; D DOT^OCXDIAG
30 ;; ;
31 ;; N CHAR,CSUM,DASH,LINE,MSG,RNDX,RPC,RTN,TEXT,X,RCSM,RDIFF
32 ;; ;
33 ;; S RCSM(3)="",RTN=$P(RSUM(0),U,1)
34 ;; F RNDX=1:1 Q:'$D(RSUM(RNDX)) F RPC=1:1:$L(RSUM(RNDX),U) S RCSM($O(RCSM(""),-1)+1)=$P(RSUM(RNDX),U,RPC)
35 ;; K RCSM(3)
36 ;; ;
37 ;; S X=RTN X ^%ZOSF("TEST") E D WARN(RTN,"Routine not in local system") Q 0
38 ;; ;
39 ;; F LINE=4:1 S TEXT=$$TEXT(RTN,LINE) Q:'$L(TEXT) I '$D(RCSM(LINE)) S RDIFF(LINE)=""
40 ;; S LINE=0 F S LINE=$O(RCSM(LINE)) Q:'LINE S TEXT=$$TEXT(RTN,LINE) D
41 ;; .S CSUM=0 F CHAR=1:1:$L(TEXT) S CSUM=CSUM+($A(TEXT,CHAR)*CHAR)
42 ;; .I '(RCSM(LINE)=(+(CSUM_"."_$L(TEXT)_"1"))) S RDIFF(LINE)=""
43 ;; ;
44 ;; Q:'$O(RDIFF(0)) 0
45 ;; ;
46 ;; D WARN(RTN,"Checksums do not match",.RDIFF)
47 ;; ;
48 ;; Q 0
49 ;; ;
50 ;;WARN(RTN,MSG,LINES) ;
51 ;; ;
52 ;; Q:$G(OCXAUTO)
53 ;; ;
54 ;; N DASH,LINE,NLINE,PLINE
55 ;; ;
56 ;; S DASH="",$P(DASH,"-",(55-$L(MSG)-2))="-"
57 ;; W !!,"----WARNING-","--",MSG,DASH
58 ;; ;
59 ;; W !,RTN,?10,"[|RUCI|] -> [",$$CUCI^OCXBDT,"] Line"
60 ;; ;
61 ;; I $O(LINES($O(LINES(0)))) W "s: "
62 ;; E W ": "
63 ;; ;
64 ;; S LINE=0 F S LINE=$O(LINES(LINE)) Q:'LINE D
65 ;; .W:($X>60) !,?40
66 ;; .S NLINE=LINE F S PLINE=NLINE,NLINE=$O(LINES(NLINE)) Q:(NLINE-PLINE-1)
67 ;; .I (PLINE=LINE) W " ",LINE
68 ;; .E W " ",LINE,"-",PLINE S LINE=PLINE
69 ;; ;
70 ;; W ! Q
71 ;; ;
72 ;;TEXT(RTN,LINE) ;
73 ;; ;
74 ;; N TEXT X "S TEXT=$T(+"_(+LINE)_"^"_RTN_")" Q TEXT
75 ;; ;
76 ;;HEADER ;
77 ;; ;
78 ;; W !," Created: |NOW| in UCI: |RUCI|"
79 ;; W !," Current Date: ",$$NOW," Current UCI: ",$$CUCI^OCXBDT,!!
80 ;; S LASTFILE=0
81 ;; K ^TMP("OCXDIAG",$J)
82 ;; S ^TMP("OCXDIAG",$J)=($P($H,",",2)+($H*86400)+(1*60*60))_" <- ^TMP ENTRY EXPIRATION DATE FOR ^OCXOPURG"
83 ;; Q
84 ;; ;
85 ;;LISTFILE(GLREF,SCANDUP) ;
86 ;; ;
87 ;; Q:($L(GLREF)<2) 0
88 ;; N D0,NAME,FILE,QUIT,CNT,FILENUM
89 ;; S QUIT=0,FILE=$P($G(@GLREF@(0)),U,1),FILENUM=+$P($G(@GLREF@(0)),U,2)
90 ;; I '$L(FILE) W !!,"Cannot find File: ",GLREF Q $$PAUSE
91 ;; I SCANDUP S (QUIT,D0)=0 F CNT=0:1 S D0=$O(@GLREF@(D0)) Q:'D0 S NAME=$P($G(@GLREF@(D0,0)),U,1) D Q:QUIT
92 ;; .D DOT^OCXDIAG
93 ;; .I '$L(NAME) W !,GLREF," ",FILE," -> Record #",D0," does not have a name." S QUIT=$$PAUSE Q
94 ;; .I OCXFLGR,'$D(^TMP("OCXDIAG",$J,"A",FILENUM,NAME)) D
95 ;; ..W !!," Extra Record in (L) ",$$CUCI^OCXBDT," - ",FILE,": ",NAME,"."
96 ;; ..S QUIT=$$DELREC^OCXDI2(FILENUM,D0)
97 ;; Q QUIT
98 ;; ;
99 ;;GETFILE(FILE,RECNAME,ARRAY) ;
100 ;; ;
101 ;; N CHECK,GLNEXT,GLREF,LINES,REC,DD,FLD
102 ;; S REC=$$LOOKUP(FILE,RECNAME)
103 ;; I 'REC W:OCXFLGR !!,$$FILENAME^OCXBDTD(FILE),": ",RECNAME," not found." Q 0
104 ;; I (REC=-1) W:OCXFLGR !!,$$FILENAME^OCXBDTD(FILE),": ",RECNAME," duplicate local entries.",! S REC=$$DELDUP^OCXDI2(FILE,RECNAME)
105 ;; I (REC=-2) W:OCXFLGR !!,$$FILENAME^OCXBDTD(FILE)," (",FILE,") local file not found." W ! Q:$$PAUSE -10 Q REC
106 ;; I (REC<0) W:OCXFLGR !!,$$FILENAME^OCXBDTD(FILE),": ",RECNAME," unknown error." W ! Q:$$PAUSE -10 Q REC
107 ;; I (REC>0) D
108 ;; .S CHECK=0,LINES=0
109 ;; .D GETREC($$FILE^OCXBDTD(FILE,"GLOBAL NAME"),"ARRAY(",REC,.ARRAY)
110 ;; .S GLREF="ARRAY" F S GLREF=$Q(@GLREF) Q:'$L(GLREF) Q:'($E(GLREF,1,6)="ARRAY(") K:'$L(@GLREF) @GLREF
111 ;; ;
112 ;; Q REC
113 ;; ;
114 ;;LKUPARRY(DD,KEY,ARRAY) ;
115 ;; ;
116 ;; N D0 S D0=0 F S D0=$O(ARRAY(DD,D0)) Q:'D0 Q:($G(ARRAY(DD,D0,.01,"E"))=KEY)
117 ;; Q D0
118 ;; ;
119 ;;LOOKUP(FILE,KEY) ;
120 ;; I $O(^TMP("OCXDIAG",$J,"B",FILE,KEY,0)) Q 0
121 ;; N RECNAM,REC,D0,CNT,SHORT S (REC,CNT)=0
122 ;; S GL=$$FILE^OCXBDTD(FILE,"GLOBAL NAME") Q:'$L(GL) -2 S GL=$E(GL,1,$L(GL)-1)_")"
123 ;; S SHORT=$E(KEY,1,30),RECNAM=SHORT D F S RECNAM=$O(@GL@("B",RECNAM)) Q:'$L(RECNAM) Q:'($E(RECNAM,1,$L(SHORT))=SHORT) D
124 ;; .S D0=0 F S D0=$O(@GL@("B",RECNAM,D0)) Q:'D0 I ($P($G(@GL@(D0,0)),U,1)=KEY) S CNT=CNT+1,REC=D0_U_RECNAME
125 ;; Q:(CNT>1) -1
126 ;; S:$L($P(REC,U,2)) ^TMP("OCXDIAG",$J,"A",FILE,$P(REC,U,2))=""
127 ;; Q +REC
128 ;; ;
129 ;;GETREC(GL,PATH,D0,REM) ;
130 ;; ;
131 ;; Q:'($P($G(@(GL_"0)")),U,2))
132 ;; N S1,DATA,DD
133 ;; S DATA="" D DIQ(GL,D0,.DATA)
134 ;; S DD=$O(DATA(0)) Q:'DD
135 ;; ;
136 ;; I $L($$FILE^OCXBDTD(DD,"NAME")) S PATH=PATH_""""_DD_":"_D0_""""
137 ;; I '$L($$FILE^OCXBDTD(DD,"NAME")) S PATH=PATH_","""_DD_":"_D0_""""
138 ;; M @(PATH_")")=DATA(DD,D0)
139 ;; ;
140 ;; S S1="" F S S1=$O(@(GL_D0_","_$$SUB(S1)_")")) Q:'$L(S1) I ($D(@(GL_D0_","_$$SUB(S1)_")"))>3) D
141 ;; .N D1,GLREF S GLREF=GL_D0_","_$$SUB(S1)_","
142 ;; .S D1=0 F S D1=$O(@(GLREF_D1_")")) Q:'D1 D GETREC(GLREF,PATH,D1,.REM)
143 ;; ;
144 ;; Q
145 ;; ;
146 ;;SUB(X) Q:'(X=+X) """"_X_"""" Q X
147 ;; ;
148 ;;DIQ(DIC,DA,OCXARY) ;
149 ;; N DR,DIQ S DR=".01:99999",DIQ="OCXARY(",DIQ(0)="EN" D EN^DIQ1
150 ;; Q
151 ;; ;
152 ;;PAUSE() Q:'OCXFLGC 0 W " Press Enter " R X:DTIME W ! Q (X[U)
153 ;; ;
154 ;;NOW() N X,Y,%DT S X="N",%DT="T" D ^%DT S Y=$$DATE^OCXBDTD(Y) S:(Y["@") Y=$P(Y,"@",1)_" at "_$P(Y,"@",2) Q Y
155 ;; ;
156 ;;$
157 ;1;
158 ;
Note: See TracBrowser for help on using the repository browser.