VistA-WorldVistAEHR/r/LAB_SERVICE-LR-LS/LRCHIVK.m

25 lines
1.1 KiB
Mathematica

LRCHIVK ;SLC/RWF - REMOVE OLD LAB DATA ; 12/14/87 15:46 ;
;;5.2;LAB SERVICE;;Sep 27, 1994
Q
EN ;from LRCHIV
U IO W @IOF,"START OF PURGE PASS" D STAMP^LRX
S LRDFN=0
DFN S LRDFN=$O(^LAR("Z",LRDFN)) G END:LRDFN="" W "."
F LRSS="CH","MI" I $O(^LAR("Z",LRDFN,LRSS,0)) S LRIDT=0,C1=1 D LAB,UPDT
S ^LAB(69.9,1,"PURGE LRDFN")=LRDFN G DFN
LAB S LRIDT=$O(^LAR("Z",LRDFN,LRSS,LRIDT)) Q:LRIDT<1
IF '$D(^LR(LRDFN,LRSS,LRIDT,0)) W !,"Data not found." G LAB
IF ^LAR("Z",LRDFN,LRSS,LRIDT,0)=^LR(LRDFN,LRSS,LRIDT,0) K ^LAR("Z",LRDFN,LRSS,LRIDT),^LR(LRDFN,LRSS,LRIDT) S ^LR(LRDFN,"T",P1,0)=P1 G LAB
W !,"^LAR and ^LR don't match, Data not purged.",!," LRDFN = ",LRDFN_" Sub Script = "_LRSS_" LRIDT = "_LRIDT
W !?4,"^LR("_LRDFN_","_LRSS_","_LRIDT_",0) = ",^LR(LRDFN,LRSS,LRIDT,0)
W !,"^LAR(""Z"","_LRDFN_","_LRSS_","_LRIDT_",0) = ",^LAR("Z",LRDFN,LRSS,LRIDT,0)
K ^LAR("Z",LRDFN,LRSS,LRIDT)
G LAB
Q
UPDT S X=0,LRCNT=0
F I=0:0 S X=$O(^LR(LRDFN,LRSS,X)) Q:X<1 S LRCNT=LRCNT+1
I LRCNT=0 S ^LR(LRDFN,LRSS,0)=$S(LRSS="CH":"^63.04D",1:"^63.05DA") Q
S $P(^LR(LRDFN,LRSS,0),U,4)=LRCNT
Q
END W !!,"**PURGE PASS DONE ** " D STAMP^LRX Q ;W @IOF G H^XUS