source: FOIAVistA/trunk/r/AUTOMATED_LAB_INSTRUMENTS-LA/LABERR.m@ 1765

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

initial load of FOIAVistA 6/30/08 version

File size: 2.6 KB
Line 
1LABERR ; SLC/FHS - ERROR TRAP FOR LABORATORY AUTO INSTRUMENTS ;11/20/90 09:45
2 ;;5.2;AUTOMATED LAB INSTRUMENTS;**42**;Sep 27, 1994
3EN ;
4 ;^LA("ERR")=Last # used^Time last error^instrument/routine^Total errors todate
5 ;^LA("ERR",#,0)=Time^IO^$J^DUZ^Tsk/instrument/routine^ZA^ZB^UCI^ZTSK
6 ;^LA("ERR",#,"ER")=Error Description
7 ;^LA("ERR",#,"ZR")=0
8 ;^LA("ERR",#,"ZTSK")=ZTSK
9 ;All local variables are stored in ^%ZTSK(ZTSK
10 ; The data is cleared on the third day (midnight) This is the default setting
11 ;Field 606 of ^LAB(69.9 allows this time to be site determined (3-30 days)
12 ;The Y(x) variable are saved in LABZY(x) and X variable is saved in LABZX
13 ;%ZTLOAD PROGRAM KILLS Y(x) VARIABLES.
14EN1 ;
15 S (LABZA,LABZB,LABZR)=0,LABZE=$$EC^%ZOSV
16 S:$D(X)#2 LABZX=X S:$D(Y)#2 LABZY=Y S:$D(%DT)#2 LABZD=%DT S:$D(X1)#2 LABZX1=X1 S:$D(LABZX2)#2 LABZX2=X2 S:$D(X3)#2 LABZX3=X3 S:$D(DT)#2 LABZDT=DT
17 S XS="" F Y=0:0 S XS=$O(Y(XS)) Q:XS="" S LABZY(XS)=Y(XS)
18 K XS N I,X,X1,Y,X2,DT,%DT,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTSK
19 S DT=$$DT^XLFDT,SY=$$NOW^XLFDT
20 L ^LA("ERR")
21 S:'$D(^LA("ERR"))#2 ^LA("ERR")=0 S ERR=+^LA("ERR")
22 S:'$D(^LA("ERR","DT",DT)) ^(DT)=0 G:^(DT)>100 FUL S $P(^LA("ERR"),"^",2)=SY
23A S ERR=ERR+1 G:$D(^LA("ERR",ERR)) A S $P(^LA("ERR"),U)=ERR,$P(^("ERR"),U,4)=1+$P(^("ERR"),U,4),^LA("ERR","DT",DT)=1+^LA("ERR","DT",DT)
24 X ^%ZOSF("UCI") S LABUCI=Y
25 S ^LA("ERR",ERR,0)=SY_U_$S($D(IO)#2:IO,$D(ION):ION,$D(IO(0)):IO(0),1:"")_U_$J_U_$S($D(DUZ):DUZ,1:.5)_U_$S($D(LANM):LANM,$D(LRINST):LRINST,$D(TSK):TSK,$D(T):T,1:"???")_U_LABZA_U_LABZB_U_Y
26 S ^("ZR")=LABZR,^("ZE")=LABZE
27 S $P(^LA("ERR"),U,3)=$P(^LA("ERR",ERR,0),U,5)
28 S ^LA("ERR","B",$P(^LA("ERR",ERR,0),U,5),ERR)=""
29 L
30 S X2=3 I $D(^LAB(69.9,1,"ER"))#2,+^("ER")>0 S X2=^("ER")
31 S X1=DT D C^%DTC S ZTDTH=X_".2359",ZTSAVE("*")="",ZTRTN="DQ^LABERR",ZTDESC="CLEAN UP LAB ERROR TRAP",ZTIO=""
32LOAD ;
33 S:$D(LABZX)#2 X=LABZX S:$D(LABZY)#2 Y=LABZY S:$D(LABZD)#2 %DT=LABZD S:$D(LABZX1)#2 X1=LABZX1 S:$D(LABZX2)#2 X2=LABZX2 S:$D(LABZX3)#2 X3=LABZX3 S:$D(LABZDT)#2 DT=LABZDT
34 K ZTSK D ^%ZTLOAD S ZTSK=$S($D(ZTSK):ZTSK,1:"???") S $P(^LA("ERR",ERR,0),U,9)=ZTSK
35 S ^LA("ERR",ERR,"ZTSK")=ZTSK
36 S ^LA("ERR","C",$P(^(0),U,5),ZTSK)=""
37FUL ;
38 L K ERR,X1,X2,ZTSK,ZTDTH,ZTRTN,ZTDESC,ZTIO,%DT,LABZX,LABUCI,LABZY,LABZA,LABZD,LABZX1,LABZX2,LABZX3,LABZB,LABZDT,LABZE,LABZR,SY Q
39 Q
40 ;
41DQ ;Dequeue errors
42 S:$D(ZTQUEUED) ZTREQ="@"
43 I $D(ERR),$D(^LA("ERR",ERR,0)) S TSK=$S($L($P(^(0),U,5)):$P(^(0),U,5),1:0),T=+$P(^(0),".") K ^LA("ERR",ERR),^LA("ERR","B",TSK,ERR) I $P(^LA("ERR"),U,4)>0 S $P(^("ERR"),U,4)=$P(^("ERR"),U,4)-1
44 I $D(TSK),$D(ZTSK) K ^LA("ERR","C",TSK,ZTSK)
45 I $D(T),$D(^LA("ERR","DT",T))#2 S:^(T)>0 ^(T)=^(T)-1 I ^(T)=0 K ^(T)
46 Q
Note: See TracBrowser for help on using the repository browser.