source: WorldVistAEHR/trunk/r/TOOLKIT-AWCM-XD-XIN-XPAR-XQAB-XT-XUC-XUR-ZIN-ZTED/XDRDPREL.m@ 1736

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

initial load of WorldVistAEHR

File size: 3.2 KB
Line 
1XDRDPREL ;SF-IRMFO.SEA/JLI - PRELIMINARY IDENTIFICATION OF ENTRIES WITH BAD DATA ;9/19/96 09:19
2 ;;7.3;TOOLKIT;**23**;Apr 25, 1995
3 ;;
4 ;;
5EN ;
6 S XDRFL=+$$FILE^XDRDPICK() G:XDRFL'>0 EXIT S XDRFNAM=$P(^DIC(XDRFL,0),U)
7 I $D(^XTMP("XDRDPREL",XDRFL," DONE")) D Q:XDRFL=0 I 1
8 . W !!,"A run was completed on "_$$HTE^XLFDT(^XTMP("XDRDPREL",XDRFL," DONE")),!!
9 . S DIR(0)="Y",DIR("A")="Do you want to view those results",DIR("B")="YES" D ^DIR K DIR
10 . I Y>0 D
11 . . D VIEW(XDRFL)
12 . . S XDRFL=0
13 E I $D(^XTMP("XDRDPREL",XDRFL," TIME")) D Q:XDRFL=0
14 . I $$HDIFF^XLFDT($H,^XTMP("XDRDPREL",XDRFL," TIME"),2)>300 Q
15 . W !!,"There appears to be a job already running. You may either"
16 . W !,"view those data or check back in about 5 minutes.",!!
17 . S DIR(0)="Y",DIR("A")="Do you want to view the running job",DIR("B")="YES" D ^DIR K DIR
18 . I Y>0 D VIEW(XDRFL)
19 . S XDRFL=0
20 S ZTRTN="DQ^XDRDPREL",ZTIO="",ZTSAVE("XDRFL")="",ZTDESC="XDRDPREL - PRELIM SCAN" D ^%ZTLOAD
21 I $D(ZTSK) W !!,"Queued as task ",ZTSK,!
22 Q
23DQ ;
24 S XDRGLB=^DIC(XDRFL,0,"GL")_"XDRDA)"
25 S XDRDR=""
26 F XDRI=0:0 S XDRI=$O(^DD(XDRFL,0,"ID",XDRI)) Q:XDRI'>0 S XDRDR=XDRDR_XDRI_";"
27 S XDRTMP="^XTMP(""XDRDPREL"",XDRFL)"
28 K @XDRTMP,XDRNV,XDRN S NTOT=0,@XDRTMP@(" TIME")=$H,@XDRTMP@(" START")=$H
29 F XDRDA=0:0 S XDRDA=$O(@XDRGLB) Q:XDRDA'>0 D
30 . I $D(@XDRGLB@(-9)) Q
31 . S @XDRTMP@(" CURR")=XDRDA,^(" TIME")=$H
32 . S NTOT=NTOT+1
33 . S @XDRTMP@(" TOTAL")=NTOT
34 . I '$D(@XDRGLB@(0)) D Q
35 . . S XXX="NO ZERO NODE"
36 . . S ^(XXX)=$G(@XDRTMP@(XXX))+1
37 . . S @XDRTMP@(XXX,XDRDA)=""
38 . I XDRDR'="" D
39 . . S DR=XDRDR
40 . . S DA=XDRDA,DIC=XDRFL,DIQ(0)="I",DIQ="XDRX" K XDRX
41 . . D EN^DIQ1
42 . . S N=0
43 . . F I=0:0 S I=$O(XDRX(XDRFL,XDRDA,I)) Q:I'>0 D
44 . . . I XDRX(XDRFL,XDRDA,I,"I")="" D
45 . . . . S N=N+1
46 . . . . S XXX="MISSING #"_I
47 . . . . S @XDRTMP@(XXX)=$G(@XDRTMP@(XXX))+1
48 . . . . S @XDRTMP@(XXX,XDRDA)=""
49 . . S XXX=$G(XDRX(XDRFL,XDRDA,$S(XDRFL=2:.09,XDRFL=200:9,1:0),"I"))
50 . . I XXX'="" D
51 . . . I XXX'?9N.E D
52 . . . . S XXX="BAD SSN"
53 . . . . S @XDRTMP@(XXX)=$G(@XDRTMP@(XXX))+1
54 . . . . S @XDRTMP@(XXX,XDRDA)=""
55 . . . . S N=N+1
56 . . I N>0 D
57 . . . S XXX="MISSING "_N_" VAL"_$S(N>1:"S",1:"")
58 . . . S @XDRTMP@(XXX)=$G(@XDRTMP@(XXX))+1
59 . . . S @XDRTMP@(XXX,XDRDA)=""
60 S @XDRTMP@(" DONE")=$H
61 K @XDRTMP@(" TIME")
62 Q
63VIEW(XDRFL) ;
64 N XDRTMP,X,Y,XTIME
65 S XDRTMP="^XTMP(""XDRDPREL"",XDRFL)"
66 I '$D(@XDRTMP) Q
67 L +@XDRTMP
68 S X=""
69 F S X=$O(@XDRTMP@(X)) Q:X="" S X(X)=@XDRTMP@(X)
70 L -@XDRTMP
71 S XRUN=$$HDIFF^XLFDT($S($D(X(" DONE")):X(" DONE"),1:X(" TIME")),X(" START"),2)
72 S XTIME=(XRUN\3600)_":"_$S((XRUN#3600\60)<10:"0",1:"")_(XRUN#3600\60)_":"_$S((XRUN#60)<10:"0",1:"")_(XRUN#60)
73 W @IOF
74 W !!!,"RUN TIME: ",XTIME," CURRENT IEN: ",X(" CURR")," FILE ENTRIES: ",X(" TOTAL")
75 W !
76 S X="" F S X=$O(X(X)) Q:X="" I X["#" D
77 . S Y=+$P(X,"#",2)
78 . W !,$J(X(X),10)," ",XDRFNAM," entries are missing field # ",Y," ",$P(^DD(XDRFL,Y,0),U)
79 I $D(X("NO ZERO NODE")) W !,$J(X("NO ZERO NODE"),10)," ",XDRFNAM," entries have NO zero node!"
80 I $D(X("BAD SSN")) W !,$J(X("BAD SSN"),10)," ",XDRFNAM," entries have bad SSN values (non-numeric, etc.)"
81 S X="" W !
82 F S X=$O(X(X)) Q:X="" I X["VAL" D
83 . S Y=+$P(X," ",2)
84 . W !,$J(X(X),10)," ",XDRFNAM," entries are missing ",Y," of the fields above"
85 W ! K DIR S DIR(0)="E" D ^DIR K DIR
86 Q
87 ;
88EXIT Q
Note: See TracBrowser for help on using the repository browser.