MCARASE ;SLC/RWF,SAE-MEDICINE AUTO INSTRUMENT SETUP VAR FOR DATA COLLECTION ;5/2/96 13:52
;;2.3;Medicine;;09/13/1996
SETTSK S:$D(ZTQUEUED) ZTREQ="@" K ZTSK ;Clean up
Q:'$D(TSK) Q:TSK<1 L +^LA("LOCK") I $D(^LA("LOCK",TSK)) S TSK=0 L -^LA("LOCK") Q
S ^LA("LOCK",TSK)=$J L -^LA("LOCK")
K ^TMP($J),^TMP("LA",$J)
S X=^LAB(62.4,TSK,0),U="^" D TRAP:$P(X,U)=MCINST
Q
TRAP S TRAP=$P(^%ZOSF("TRAP"),"=")_"=""TRAP^"_LANM_""""
Q
NEW S ZTRTN=U_$P(^LAB(62.4,T,0),U,3),ZTDTH=$H,ZTIO=""
D SET,^%ZTLOAD:$L(ZTRTN)>3
Q
RESTART I $D(^LA(T,"I",0)) S ZTRTN=U_$P(^LAB(62.4,T,0),U,3),ZTDTH=$H,ZTIO="" D ^%ZTLOAD:$L(ZTRTN)>3
Q
SET S ER=$D(^LA(T,"I"))#2 Q:ER S ^LA(T,"I")=0,^("I",0)=0,^LA(T,"O")=0,^("O",0)=0
Q
ERROR S ^TMP($J,1)=LANM,^(2)=TSK I $G(^%ZOSF("ERRTN"))]"" D @^%ZOSF("ERRTN")
S LANM=^TMP($J,1),TSK=^(2),U="^"
Q
MCARASE ;SLC/RWF,SAE-MEDICINE AUTO INSTRUMENT SETUP VAR FOR DATA COLLECTION ;5/2/96 13:52
+1 ;;2.3;Medicine;;09/13/1996
SETTSK ;Clean up
IF $DATA(ZTQUEUED)
SET ZTREQ="@"
KILL ZTSK
+1 IF '$DATA(TSK)
QUIT
IF TSK<1
QUIT
LOCK +^LA("LOCK")
IF $DATA(^LA("LOCK",TSK))
SET TSK=0
LOCK -^LA("LOCK")
QUIT
+2 SET ^LA("LOCK",TSK)=$JOB
LOCK -^LA("LOCK")
+3 KILL ^TMP($JOB),^TMP("LA",$JOB)
+4 SET X=^LAB(62.4,TSK,0)
SET U="^"
IF $PIECE(X,U)=MCINST
DO TRAP
+5 QUIT
TRAP SET TRAP=$PIECE(^%ZOSF("TRAP"),"=")_"=""TRAP^"_LANM_""""
+1 QUIT
NEW SET ZTRTN=U_$PIECE(^LAB(62.4,T,0),U,3)
SET ZTDTH=$HOROLOG
SET ZTIO=""
+1 DO SET
IF $LENGTH(ZTRTN)>3
DO ^%ZTLOAD
+2 QUIT
RESTART IF $DATA(^LA(T,"I",0))
SET ZTRTN=U_$PIECE(^LAB(62.4,T,0),U,3)
SET ZTDTH=$HOROLOG
SET ZTIO=""
IF $LENGTH(ZTRTN)>3
DO ^%ZTLOAD
+1 QUIT
SET SET ER=$DATA(^LA(T,"I"))#2
IF ER
QUIT
SET ^LA(T,"I")=0
SET ^("I",0)=0
SET ^LA(T,"O")=0
SET ^("O",0)=0
+1 QUIT
ERROR SET ^TMP($JOB,1)=LANM
SET ^(2)=TSK
IF $GET(^%ZOSF("ERRTN"))]""
DO @^%ZOSF("ERRTN")
+1 SET LANM=^TMP($JOB,1)
SET TSK=^(2)
SET U="^"
+2 QUIT