LAH747 ;SLC/FHS/RAF - HITACHI 747 ;8/15/92 15:41
;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
;CROSS LINK BY ID
LA1 S:$D(ZTQUEUED) ZTREQ="@" S LANM=$T(+0),TSK=$O(^LAB(62.4,"C",LANM,0)) Q:TSK<1
Q:'$D(^LA(TSK,"I",0))
D ^LASET Q:'TSK S X="TRAP^"_LANM,@^%ZOSF("TRAP")
K TEST S J="" F S J=$O(TC(J)) Q:J="" S TEST(TC(J,4))=J
LA2 K TV,Y S TOUT=0,A=1,CTRL="" D IN G QUIT:TOUT,LA2:CTRL'="B" S TOUT=0 D IN G QUIT:TOUT,LA2:$E(IN,2)'="A"&($E(IN,2)'="G") D QC
F A=2:1 Q:CTRL="C" S TOUT=0 D IN G QUIT:TOUT D QC
S TOUT=0 D IN G QUIT:TOUT S CKSUM=IN S (TRAY,ID,IDE,CUP)=0 S V=$E(Y(1),4,7) D NUM S TRAY=+V,V=$E(Y(1),8,12) D NUM S IDE=+V,CUP=+$E(Y(1),13),V=$E(Y(1),14,26) D NUM S ID=+V
S V=$E(Y(1),27,28) D NUM S NT=+V G:'NT LA2
S Y(1)=$E(Y(1),29,255) F I=1:1:NT Q:'$L(Y(1)) S Y=$E(Y(1),1,9),Y(1)=$E(Y(1),10,255) I $E(Y,9)="@" S V=$E(Y,1,2) D NUM S TEST=+V,V=$E(Y,3,8) D NUM S VAL=+V D LA4
LA3 X LAGEN G LA2:'ISQN ;Can be changed by the cross-link code
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
LA4 Q:'$D(TEST(TEST)) I VAL S II=TEST(TEST),@TC(II,1)=VAL D
.I $L($G(TC(II,2))) X TC(II,2) S @TC(II,1)=V,VAL=V
Q
QC ;
S Y(A)=IN 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
NUM ;
S X="" F JJ=1:1:$L(V) S:$A(V,JJ)>32 X=X_$E(V,JJ)
S V=X Q
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 G:^LA(TSK,"I")>^LA(TSK,"I",0) LA2 I $D(^LA(TSK,"O"))#2 G:^LA(TSK,"O")>^LA(TSK,"O",0) LA2
K ^LA(TSK,"O") S ^LA(TSK,"O")=0,^("O",0)=0
LOCK ^LA(TSK) H 1 K ^LA(TSK,"I"),^LA("LOCK",TSK),A,CKSUM,CNT,CTRL D
.K CUP,I,ID,IDE,II,IN,ISQN,J,JJ,LAGEN,LANM,LWL,NT,OUT,Q,T,TC,TEST
.K TOUT,TRAY,TSK,TV,V,VAL,X,Y
Q
TRAP D ^LABERR S T=TSK D SET^LAB G @("LA2^"_LANM) ; ERROR TRAP
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HLAH747 1912 printed Dec 13, 2024@01:42:38 Page 2
LAH747 ;SLC/FHS/RAF - HITACHI 747 ;8/15/92 15:41
+1 ;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
+2 ;CROSS LINK BY ID
LA1 if $DATA(ZTQUEUED)
SET ZTREQ="@"
SET LANM=$TEXT(+0)
SET TSK=$ORDER(^LAB(62.4,"C",LANM,0))
if TSK<1
QUIT
+1 if '$DATA(^LA(TSK,"I",0))
QUIT
+2 DO ^LASET
if 'TSK
QUIT
SET X="TRAP^"_LANM
SET @^%ZOSF("TRAP")
+3 KILL TEST
SET J=""
FOR
SET J=$ORDER(TC(J))
if J=""
QUIT
SET TEST(TC(J,4))=J
LA2 KILL TV,Y
SET TOUT=0
SET A=1
SET CTRL=""
DO IN
if TOUT
GOTO QUIT
if CTRL'="B"
GOTO LA2
SET TOUT=0
DO IN
if TOUT
GOTO QUIT
if $EXTRACT(IN,2)'="A"&($EXTRACT(IN,2)'="G")
GOTO LA2
DO QC
+1 FOR A=2:1
if CTRL="C"
QUIT
SET TOUT=0
DO IN
if TOUT
GOTO QUIT
DO QC
+2 SET TOUT=0
DO IN
if TOUT
GOTO QUIT
SET CKSUM=IN
SET (TRAY,ID,IDE,CUP)=0
SET V=$EXTRACT(Y(1),4,7)
DO NUM
SET TRAY=+V
SET V=$EXTRACT(Y(1),8,12)
DO NUM
SET IDE=+V
SET CUP=+$EXTRACT(Y(1),13)
SET V=$EXTRACT(Y(1),14,26)
DO NUM
SET ID=+V
+3 SET V=$EXTRACT(Y(1),27,28)
DO NUM
SET NT=+V
if 'NT
GOTO LA2
+4 SET Y(1)=$EXTRACT(Y(1),29,255)
FOR I=1:1:NT
if '$LENGTH(Y(1))
QUIT
SET Y=$EXTRACT(Y(1),1,9)
SET Y(1)=$EXTRACT(Y(1),10,255)
IF $EXTRACT(Y,9)="@"
SET V=$EXTRACT(Y,1,2)
DO NUM
SET TEST=+V
SET V=$EXTRACT(Y,3,8)
DO NUM
SET VAL=+V
DO LA4
LA3 ;Can be changed by the cross-link code
XECUTE LAGEN
if 'ISQN
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
LA4 if '$DATA(TEST(TEST))
QUIT
IF VAL
SET II=TEST(TEST)
SET @TC(II,1)=VAL
Begin DoDot:1
+1 IF $LENGTH($GET(TC(II,2)))
XECUTE TC(II,2)
SET @TC(II,1)=V
SET VAL=V
End DoDot:1
+2 QUIT
QC ;
+1 SET Y(A)=IN
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
NUM ;
+1 SET X=""
FOR JJ=1:1:$LENGTH(V)
if $ASCII(V,JJ)>32
SET X=X_$EXTRACT(V,JJ)
+2 SET V=X
QUIT
+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 if ^LA(TSK,"I")>^LA(TSK,"I",0)
GOTO LA2
IF $DATA(^LA(TSK,"O"))#2
if ^LA(TSK,"O")>^LA(TSK,"O",0)
GOTO LA2
+1 KILL ^LA(TSK,"O")
SET ^LA(TSK,"O")=0
SET ^("O",0)=0
+2 LOCK ^LA(TSK)
HANG 1
KILL ^LA(TSK,"I"),^LA("LOCK",TSK),A,CKSUM,CNT,CTRL
Begin DoDot:1
+3 KILL CUP,I,ID,IDE,II,IN,ISQN,J,JJ,LAGEN,LANM,LWL,NT,OUT,Q,T,TC,TEST
+4 KILL TOUT,TRAY,TSK,TV,V,VAL,X,Y
End DoDot:1
+5 QUIT
TRAP ; ERROR TRAP
DO ^LABERR
SET T=TSK
DO SET^LAB
GOTO @("LA2^"_LANM)