source: FOIAVistA/trunk/r/RECORD_TRACKING-RT/RTFIX.m@ 1582

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

initial load of FOIAVistA 6/30/08 version

File size: 3.7 KB
Line 
1RTFIX ;PKE/ISC-ALBANY-Cleanup 190.3 Routine; ; 4/7/93 11:45 AM ; [ 08/01/93 9:42 PM ]
2 ;;v 2.0;Record Tracking;**12**;10/22/91
3 ;check movement file, #190.3 for pointers, x-ref
4 ;
5EN ;entry point
6 L +^TMP("RTFIX","START"):300 E W !!?3,"Another RTFIX is running" Q
7 ;
8 ;if RTDB=0 just checks for bad nodes(debug)
9 I '$D(RTDB) S RTDB=1
10 ;
11 ;if debug was on, start over
12 I RTDB,$D(^TMP("RTFIX","DEBUG")) K ^TMP("RTFIX")
13 ;if debug is on, remember
14 I RTDB=0 S ^TMP("RTFIX","DEBUG")=""
15 ;
16 S RT=$S('$D(^TMP("RTFIX","START")):0,1:+^("START")) I RT S RT=RT-1
17 D DT^DICRW,NOW^%DTC S RTIME=%,RTIM=X
18 ;purge-node if using xtmp
19 S X1=X,X2=5 D C^%DTC
20 S $P(^TMP("RTFIX",0),"^",1,2)=X_"^"_RTIM
21 S ^TMP("RTFIX","START")=RT_"^"_RTIME
22 K ^TMP("RTFIX","STOP")
23 ;
24CONT F RTCT=1:1 S RT=$O(^RTV(190.3,"B",RT)) Q:'RT DO
25 .I RTCT#1000=0 DO
26 ..S $P(^TMP("RTFIX","START"),"^",1)=RT
27 ..I '$D(^TMP("RTFIX","RATE")) S (RATE,^("RATE"))=$P($H,",",2)
28 ..E S RATE=$P(^("RATE"),"^"),RATE=(+$P($H,",",2))-RATE ;naked ref to tmp(rtfix,rate)
29 ..S RATE=$J((RATE/60),5,1)
30 ..S ^("RATE")=$P($H,",",2)_"^"_RATE_"^"_RT ;naked ref to tmp(rtfix,rate)
31 ..I $D(^TMP("RTFIX","STOP")) S RT="Zend" Q ;stop if stopjob^rtfix
32 ..I $$S^%ZTLOAD S RT="Zend",^TMP("RTFIX","STOP")="",ZTSTOP=1 Q
33 ..I '$D(ZTQUEUED) W "."
34 .;
35 .S RTH=0
36 .F S RTH=$O(^RTV(190.3,"B",RT,RTH)) Q:'RTH DO
37 ..I '$D(^RTV(190.3,RTH,0)) DO Q
38 ...L +^RTV(190.3,RTH)
39 ...K:RTDB ^RTV(190.3,"B",RT,RTH) L -^RTV(190.3,RTH)
40 ...S ^TMP("RTFIX","XREF",RTH)=RT
41 ...Q
42 ..I +^RTV(190.3,RTH,0)'=RT DO Q
43 ...S RTM0=^(0) ;naked ref to rtv(190.3,rth,0)
44 ...I 'RTM0,$D(^RT(RT,"CL")),+$P(^("CL"),"^",2)=RTH Q
45 ...L +^RTV(190.3,RTH)
46 ...K:RTDB ^RTV(190.3,"B",RT,RTH) L -^RTV(190.3,RTH)
47 ...S DA=RTH,DIK="^RTV(190.3,"
48 ...I '$D(^RT(+RTM0,0)) D:RTDB ^DIK S ^TMP("RTFIX","XMOVE",RTH)=RT Q
49 ...I RTM0 D:RTDB IX^DIK S ^TMP("RTFIX","XINDEX",RTH)=RT
50 ...Q
51 ..Q
52 ;
53 L -^TMP("RTFIX","START")
54 D NOW^%DTC I $D(^TMP("RTFIX","STOP")) S ^("STOP")=%_"^"_RTCT N ZTSTOP D KILL Q
55 K:RTDB ^TMP("RTFIX")
56KILL D KILL^XUSCLEAN Q
57 ;
58QUE ;entry to queue with taskman from prog mode
59 S ZTIO="",ZTRTN="EN^RTFIX",ZTDESC="RT Check/Fix file 190.3"
60 D ^%ZTLOAD Q
61 ;
62JOB S ZTQUEUED="" G EN^RTFIX Q
63 ;
64DEBUG S RTDB=0 G EN^RTFIX Q
65 ;
66STOPJOB ;entry to stop job after about 1000 records if jobbed or tasked
67 S ^TMP("RTFIX","STOP")=""
68 W !?5,"The RTFIX routine will be stopping soon . . ." Q
69 ;
70RATE ;entry to see how its going
71 Q:'$D(^TMP("RTFIX","RATE"))
72 L +^TMP("RTFIX","RATE")
73 W !?3,"Minutes/1K records = ",$P(^TMP("RTFIX","RATE"),"^",2)
74 W !?3," Current Record # = ",$P(^TMP("RTFIX","RATE"),"^",3)
75 W !?3," Last Record # = ",$P(^RT(0),"^",3),!
76 L -^TMP("RTFIX","RATE") Q
77 ;
78DOC ;The routine can run from programmer mode by
79 ;D ^RTFIX
80 ;
81 ;The routine can be queued through TaskMan by
82 ;D QUE^RTFIX
83 ;
84 ;The routine can be run in DEBUG mode by
85 ;D DEBUG^RTFIX
86 ;
87 ;The routine can be stopped at any time by
88 ;D STOPJOB^RTFIX or TBOX option for a taskman job
89 ;
90 ;The routine can be restarted where it left off as
91 ;long as the global ^TMP("RTFIX" still exists.
92 ;
93 ;The status of the job can be monitored by
94 ;D RATE^RTFIX
95 ;
96 ;XQ XUTL $J NODES option should be suspended on cpu when this
97 ;routine is running to prevent ^TMP from being killed
98 ;
99 ;^TMP is only used to store start/stop and bad movements found
100 ;
101 ; Can be changed to use standard use of ^xtmp global by changing
102 ; every ^tmp to ^xtmp. Will set nodes correctly to avoid xtmp
103 ; purge.
104 ;
105 ;^TMP(nodes) description action
106 ;
107 ;^("XREF",RTMOV)=RT means a "B" entry with xref deleted
108 ; no zero node
109 ;^("XMOVE"... means no record movement deleted
110 ;^("XINDEX"... means different record xref corrected
Note: See TracBrowser for help on using the repository browser.