LACEL8E ; IHS/DIR/FJE - CELLECT 8E 8/16/90 14:07 ;
;;5.2;LA;;NOV 01, 1997
;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
; CROSS LINK ID = SEQ # ,TRAY=1, CUP = ID
LA1 S:$D(ZTQUEUED) ZTREQ="@"
S LANM=$T(+0),TSK=$O(^LAB(62.4,"C",LANM,0)),U="^" Q:TSK<1
Q:'$D(^LA(TSK,"I",0))
S TOUT=0,TP="",LRTOP=$P(^LAB(69.9,1,1),U,1) D ^LASET Q:'TSK S X="TRAP^"_LANM,@^%ZOSF("TRAP")
F I=1:1:10 S ZZ(I)=$P("WBC^RBC^HB^HCT^MCV^MCH^MCHC^RDW^PLT^MPV",U,I),ZZ("B",ZZ(I),I)=""
LA2 K TV,Y S A=0,TOUT=0 D IN G QUIT:TOUT D NUM G LA2:$E(IN,1,2)'=",," D QC
S TOUT=0 F I=0:0 D IN Q:TOUT Q:IN="" D NUM,QC
G QUIT:TOUT S TRAY=1,(ID,IDE,CUP)=$P(Y(1),",",3) G LA2:ID'>0
S SPEC=$P(^LAB(69.9,1,1),U,1)
F J=2:1:A S Z=$P(Y(J),",") I Z]"" S I=$O(ZZ("B",Z,0)) I I>0 S V=$P(Y(J),",",2) S @TC(I,1)=+V
LA3 X LAGEN G LA2:ISQN<1
F I=0:0 S I=$O(TV(I)) Q:I<1 S:TV(I,1)]"" ^LAH(LWL,1,ISQN,I)=TV(I,1)
G LA2
IN S CNT=^LA(TSK,"I",0)+1 IF '$D(^(CNT)) S TOUT=TOUT+1 Q:TOUT>9 H 9 G IN
S ^LA(TSK,"I",0)=CNT,IN=^(CNT),TOUT=0
S:IN["~" CTRL=$P(IN,"~",2),IN=$P(IN,"~",1)
Q
QC S A=A+1,Y(A)=IN Q
NUM S X="" F I=1:1:$L(IN) S:$A(IN,I)-32 X=X_$E(IN,I)
S IN=X Q
OUT S CNT=^LA(TQ,"O")+1,^("O")=CNT,^("O",CNT)=OUT
LOCK ^LA("Q") S Q=^LA("Q")+1,^("Q")=Q,^("Q",Q)=TQ LOCK
Q
QUIT LOCK ^LA(TSK) H 1 K ^LA(TSK),^LA("LOCK",TSK),^TMP($J),^TMP("LA",$J)
Q
TRAP D ^LABERR S T=TSK D SET^LAB G @("LA2^"_LANM) ;ERROR TRAP
LACEL8E ; IHS/DIR/FJE - CELLECT 8E 8/16/90 14:07 ;
+1 ;;5.2;LA;;NOV 01, 1997
+2 ;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
+3 ; CROSS LINK ID = SEQ # ,TRAY=1, CUP = ID
LA1 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+1 SET LANM=$TEXT(+0)
SET TSK=$ORDER(^LAB(62.4,"C",LANM,0))
SET U="^"
IF TSK<1
QUIT
+2 IF '$DATA(^LA(TSK,"I",0))
QUIT
+3 SET TOUT=0
SET TP=""
SET LRTOP=$PIECE(^LAB(69.9,1,1),U,1)
DO ^LASET
IF 'TSK
QUIT
SET X="TRAP^"_LANM
SET @^%ZOSF("TRAP")
+4 FOR I=1:1:10
SET ZZ(I)=$PIECE("WBC^RBC^HB^HCT^MCV^MCH^MCHC^RDW^PLT^MPV",U,I)
SET ZZ("B",ZZ(I),I)=""
LA2 KILL TV,Y
SET A=0
SET TOUT=0
DO IN
IF TOUT
GOTO QUIT
DO NUM
IF $EXTRACT(IN,1,2)'=",,"
GOTO LA2
DO QC
+1 SET TOUT=0
FOR I=0:0
DO IN
IF TOUT
QUIT
IF IN=""
QUIT
DO NUM
DO QC
+2 IF TOUT
GOTO QUIT
SET TRAY=1
SET (ID,IDE,CUP)=$PIECE(Y(1),",",3)
IF ID'>0
GOTO LA2
+3 SET SPEC=$PIECE(^LAB(69.9,1,1),U,1)
+4 FOR J=2:1:A
SET Z=$PIECE(Y(J),",")
IF Z]""
SET I=$ORDER(ZZ("B",Z,0))
IF I>0
SET V=$PIECE(Y(J),",",2)
SET @TC(I,1)=+V
LA3 XECUTE LAGEN
IF ISQN<1
GOTO LA2
+1 FOR I=0:0
SET I=$ORDER(TV(I))
IF I<1
QUIT
IF TV(I,1)]""
SET ^LAH(LWL,1,ISQN,I)=TV(I,1)
+2 GOTO LA2
IN SET CNT=^LA(TSK,"I",0)+1
IF '$DATA(^(CNT))
SET TOUT=TOUT+1
IF TOUT>9
QUIT
HANG 9
GOTO IN
+1 SET ^LA(TSK,"I",0)=CNT
SET IN=^(CNT)
SET TOUT=0
+2 IF IN["~"
SET CTRL=$PIECE(IN,"~",2)
SET IN=$PIECE(IN,"~",1)
+3 QUIT
QC SET A=A+1
SET Y(A)=IN
QUIT
NUM SET X=""
FOR I=1:1:$LENGTH(IN)
IF $ASCII(IN,I)-32
SET X=X_$EXTRACT(IN,I)
+1 SET IN=X
QUIT
OUT SET CNT=^LA(TQ,"O")+1
SET ^("O")=CNT
SET ^("O",CNT)=OUT
+1 LOCK ^LA("Q")
SET Q=^LA("Q")+1
SET ^("Q")=Q
SET ^("Q",Q)=TQ
LOCK
+2 QUIT
QUIT LOCK ^LA(TSK)
HANG 1
KILL ^LA(TSK),^LA("LOCK",TSK),^TMP($JOB),^TMP("LA",$JOB)
+1 QUIT
TRAP ;ERROR TRAP
DO ^LABERR
SET T=TSK
DO SET^LAB
GOTO @("LA2^"_LANM)