LAACA ;SLC/RWF/CJS - 'ACA3' ROUTINE FOR AUTOMATED DATA ;8/16/90 14:52 ;
;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
;CROSS LINK BY IDE = CARD READER DATA, ID = SAMPLE SEQUENCE #
LA1 S LANM=$T(+0),TSK=$O(^LAB(62.4,"C",LANM,0)) Q:TSK<1 S X=^LAB(62.4,TSK,0),U="^"
Q:'$D(^LA(TSK,"I",0))
S IDT=0 K LRTOP D ^LASET Q:'TSK S (PID,PSPEC,TP)=0,SS="CH",X="TRAP^"_LANM,@^%ZOSF("TRAP")
LA2 S TOUT=0,BAD=0 F A=1 D IN S Y(1)=IN D QC G QUIT:TOUT
I BAD G LA2
K TV
S ACA=+$E(Y(1),31,32),TC=$S($D(^LAB(62.4,TSK,3,ACA,0)):^(1),1:"TV(1,1)")
S V=$S($E(Y(1),42)]" ":+$E(Y(1),42,49),1:+$E(Y(1),43,49)),DIL=+$E(Y(1),18)_$E(Y(1),19) S:DIL>1 V=V*DIL
S @TC=$S(TC["99,":"TEST NOT FOUND "_$E(Y(1),34,37)_" ",1:"")_V
S IDE=+$E(Y(1),21,29),ID=+$E(Y(1),6,9),CUP=ID,TRAY=1,SPEC=$P(^LAB(69.9,1,1),U,3),RT=NOW
LA3 I (IDE'=PID)!(PSPEC'=SPEC) X LAGEN S PID=IDE,PSPEC=SPEC
F I=0:0 S I=$O(TV(I)) Q:I<1 D LA4
G LA2
LA4 S R=$S($D(TV(I,1)):TV(I,1),1:"") S:R]"" ^LAH(LWL,1,ISQN,I)=R
Q
QC ;QC TESTING HERE; S BAD=1 IF DONT STORE
S:$E(Y(1),51,52)]" " BAD=1 S:$E(Y(1),17)]" " BAD=1
S:$L(Y(1))'=60 BAD=1 Q
IN S CNT=^LA(TSK,"I",0)+1 IF '$D(^(CNT)) S TOUT=TOUT+1 Q:TOUT>9 H 5 G IN
S ^LA(TSK,"I",0)=CNT,IN=^(CNT),TOUT=0
S:IN["~" CTRL=$P(IN,"~",2),IN=$P(IN,"~",1)
Q
OUT S CNT=^LA(TSK,"O")+1,^("O")=CNT,^("O",CNT)=OUT
LOCK ^LA("Q") S Q=^LA("Q")+1,^("Q")=Q,^("Q",Q)=TSK LOCK
Q
QUIT LOCK ^LA(TSK) H 1 K ^LA(TSK),^LA("LOCK",TSK),^TMP($J),^TMP("LA",$J) S:$D(ZTQUEUED) ZTREQ="@"
Q
TRAP D ^LABERR S T=TSK D SET^LAB G @("LA2^"_LANM) ;ERROR TRAP
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HLAACA 1546 printed Dec 13, 2024@01:41:18 Page 2
LAACA ;SLC/RWF/CJS - 'ACA3' ROUTINE FOR AUTOMATED DATA ;8/16/90 14:52 ;
+1 ;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
+2 ;CROSS LINK BY IDE = CARD READER DATA, ID = SAMPLE SEQUENCE #
LA1 SET LANM=$TEXT(+0)
SET TSK=$ORDER(^LAB(62.4,"C",LANM,0))
if TSK<1
QUIT
SET X=^LAB(62.4,TSK,0)
SET U="^"
+1 if '$DATA(^LA(TSK,"I",0))
QUIT
+2 SET IDT=0
KILL LRTOP
DO ^LASET
if 'TSK
QUIT
SET (PID,PSPEC,TP)=0
SET SS="CH"
SET X="TRAP^"_LANM
SET @^%ZOSF("TRAP")
LA2 SET TOUT=0
SET BAD=0
FOR A=1
DO IN
SET Y(1)=IN
DO QC
if TOUT
GOTO QUIT
+1 IF BAD
GOTO LA2
+2 KILL TV
+3 SET ACA=+$EXTRACT(Y(1),31,32)
SET TC=$SELECT($DATA(^LAB(62.4,TSK,3,ACA,0)):^(1),1:"TV(1,1)")
+4 SET V=$SELECT($EXTRACT(Y(1),42)]" ":+$EXTRACT(Y(1),42,49),1:+$EXTRACT(Y(1),43,49))
SET DIL=+$EXTRACT(Y(1),18)_$EXTRACT(Y(1),19)
if DIL>1
SET V=V*DIL
+5 SET @TC=$SELECT(TC["99,":"TEST NOT FOUND "_$EXTRACT(Y(1),34,37)_" ",1:"")_V
+6 SET IDE=+$EXTRACT(Y(1),21,29)
SET ID=+$EXTRACT(Y(1),6,9)
SET CUP=ID
SET TRAY=1
SET SPEC=$PIECE(^LAB(69.9,1,1),U,3)
SET RT=NOW
LA3 IF (IDE'=PID)!(PSPEC'=SPEC)
XECUTE LAGEN
SET PID=IDE
SET PSPEC=SPEC
+1 FOR I=0:0
SET I=$ORDER(TV(I))
if I<1
QUIT
DO LA4
+2 GOTO LA2
LA4 SET R=$SELECT($DATA(TV(I,1)):TV(I,1),1:"")
if R]""
SET ^LAH(LWL,1,ISQN,I)=R
+1 QUIT
QC ;QC TESTING HERE; S BAD=1 IF DONT STORE
+1 if $EXTRACT(Y(1),51,52)]" "
SET BAD=1
if $EXTRACT(Y(1),17)]" "
SET BAD=1
+2 if $LENGTH(Y(1))'=60
SET BAD=1
QUIT
IN SET CNT=^LA(TSK,"I",0)+1
IF '$DATA(^(CNT))
SET TOUT=TOUT+1
if TOUT>9
QUIT
HANG 5
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
OUT SET CNT=^LA(TSK,"O")+1
SET ^("O")=CNT
SET ^("O",CNT)=OUT
+1 LOCK ^LA("Q")
SET Q=^LA("Q")+1
SET ^("Q")=Q
SET ^("Q",Q)=TSK
LOCK
+2 QUIT
QUIT LOCK ^LA(TSK)
HANG 1
KILL ^LA(TSK),^LA("LOCK",TSK),^TMP($JOB),^TMP("LA",$JOB)
if $DATA(ZTQUEUED)
SET ZTREQ="@"
+1 QUIT
TRAP ;ERROR TRAP
DO ^LABERR
SET T=TSK
DO SET^LAB
GOTO @("LA2^"_LANM)