LASTRA ;SLC/RWF - ASTRA 4,6,8,8E,IDEAL,CX3 (NON-CALCULATING) ;8/16/90 13:53 ;
;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
;CROSS LINK ID=TRAY_CUP, IDE = ENTERED IDENT.
S:$D(ZTQUEUED) ZTREQ="@" S LANM=$T(+0),TSK=+$O(^LAB(62.4,"C",LANM,0)) Q:'$D(^LA(TSK,"I",0))
S SS="CH",IDT=0 D ^LASET Q:TSK<1 S X="TRAP^"_LANM,@^%ZOSF("TRAP")
F I=0:0 S I=$O(TC(I)) Q:I'>0 S LA(TC(I,4))=TC(I,1)
S TOUT=0,ID=0,ERR=0,SAM="S"
LA2 ;NEEDED TO MAKE TRAP CALL CONSISTENT WITH OTHER INSTRUMENT ROUTINES
LA1 D IN G QUIT:TOUT,LA9:IN'?1"[".ANP1"]".AN
S TAG=+$E(IN,2,3) G NEW:TAG=1,DATA:TAG=2,ET:TAG=99,DATA:TAG=3,LA1
DATA D CS S ERR=ERR+ER
DA2 S TEST=$P(IN,",",2) IF '$D(LA(TEST)) G LA1
S X=$P(IN,",",3) D PACK S X=$S(X="0000":"*",X="T.O":"*",1:+X),@LA(TEST)=X G LA1
CALC S IN=$P(IN,"]",1) G DA2 ;PROCESS SAME AS DATA
NEW S PT=$E(IN,5,6),X=$E(IN,8,16),ERR=0 D PACK S IDE=+X
F I=0:0 S I=$O(TC(I)) Q:I'>0 S @TC(I,1)=""
S TRAY=+$E(IN,30,31),CUP=+$E(IN,33,34),TYPE=$E(IN,36,37),SAM=$E(IN,39),ID=TRAY_CUP
IDQC D CS S ERR=ERR+ER
S:TYPE="CO" CTRL=1 G LA1
ET IF ERR>1!('ID) G LA9
S SPEC=$S(SAM="S":$P(^LAB(69.9,1,1),U,3),1:$P(^LAB(69.9,1,1),U,2))
X LAGEN
F I=0:0 S I=$O(TV(I)) Q:I<1 D LA4
LA9 S REC="",IDE=0,ID=0 G LA1
LA4 S R=$S($D(TV(I,1)):TV(I,1),1:"")
S:R]"" ^LAH(LWL,1,ISQN,I)=R Q
Q
Q
CS S CS=0,Y=$L(IN)-1 F I=1:1:Y-1 S CS=$A(IN,I)+CS
S X=$A(IN,Y)-48 S:X>9 X=X-7 S ER=X*16,X=$A(IN,Y+1)-48 S:X>9 X=X-7 S X=X+ER
S ER=CS+X#256
Q
PACK S Y=X,X="" F I=1:1:$L(Y) S:$A(Y,I)-32 X=X_$E(Y,I)
Q:X="" S:X'?.P1N.NP X="*" Q
IN S CNT=^LA(TSK,"I",0)+1 IF '$D(^(CNT)) Q:TOUT>9 S TOUT=TOUT+1 H 9 G IN
S IN=^(CNT),^(0)=CNT,TOUT=0
S:IN["~" CTRL=$P(IN,"~",2),IN=$P(IN,"~",1)
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
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HLASTRA 1839 printed Oct 16, 2024@17:45:10 Page 2
LASTRA ;SLC/RWF - ASTRA 4,6,8,8E,IDEAL,CX3 (NON-CALCULATING) ;8/16/90 13:53 ;
+1 ;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
+2 ;CROSS LINK ID=TRAY_CUP, IDE = ENTERED IDENT.
+3 if $DATA(ZTQUEUED)
SET ZTREQ="@"
SET LANM=$TEXT(+0)
SET TSK=+$ORDER(^LAB(62.4,"C",LANM,0))
if '$DATA(^LA(TSK,"I",0))
QUIT
+4 SET SS="CH"
SET IDT=0
DO ^LASET
if TSK<1
QUIT
SET X="TRAP^"_LANM
SET @^%ZOSF("TRAP")
+5 FOR I=0:0
SET I=$ORDER(TC(I))
if I'>0
QUIT
SET LA(TC(I,4))=TC(I,1)
+6 SET TOUT=0
SET ID=0
SET ERR=0
SET SAM="S"
LA2 ;NEEDED TO MAKE TRAP CALL CONSISTENT WITH OTHER INSTRUMENT ROUTINES
LA1 DO IN
if TOUT
GOTO QUIT
if IN'?1"[".ANP1"]".AN
GOTO LA9
+1 SET TAG=+$EXTRACT(IN,2,3)
if TAG=1
GOTO NEW
if TAG=2
GOTO DATA
if TAG=99
GOTO ET
if TAG=3
GOTO DATA
GOTO LA1
DATA DO CS
SET ERR=ERR+ER
DA2 SET TEST=$PIECE(IN,",",2)
IF '$DATA(LA(TEST))
GOTO LA1
+1 SET X=$PIECE(IN,",",3)
DO PACK
SET X=$SELECT(X="0000":"*",X="T.O":"*",1:+X)
SET @LA(TEST)=X
GOTO LA1
CALC ;PROCESS SAME AS DATA
SET IN=$PIECE(IN,"]",1)
GOTO DA2
NEW SET PT=$EXTRACT(IN,5,6)
SET X=$EXTRACT(IN,8,16)
SET ERR=0
DO PACK
SET IDE=+X
+1 FOR I=0:0
SET I=$ORDER(TC(I))
if I'>0
QUIT
SET @TC(I,1)=""
+2 SET TRAY=+$EXTRACT(IN,30,31)
SET CUP=+$EXTRACT(IN,33,34)
SET TYPE=$EXTRACT(IN,36,37)
SET SAM=$EXTRACT(IN,39)
SET ID=TRAY_CUP
IDQC DO CS
SET ERR=ERR+ER
+1 if TYPE="CO"
SET CTRL=1
GOTO LA1
ET IF ERR>1!('ID)
GOTO LA9
+1 SET SPEC=$SELECT(SAM="S":$PIECE(^LAB(69.9,1,1),U,3),1:$PIECE(^LAB(69.9,1,1),U,2))
+2 XECUTE LAGEN
+3 FOR I=0:0
SET I=$ORDER(TV(I))
if I<1
QUIT
DO LA4
LA9 SET REC=""
SET IDE=0
SET ID=0
GOTO LA1
LA4 SET R=$SELECT($DATA(TV(I,1)):TV(I,1),1:"")
+1 if R]""
SET ^LAH(LWL,1,ISQN,I)=R
QUIT
+2 QUIT
+3 QUIT
CS SET CS=0
SET Y=$LENGTH(IN)-1
FOR I=1:1:Y-1
SET CS=$ASCII(IN,I)+CS
+1 SET X=$ASCII(IN,Y)-48
if X>9
SET X=X-7
SET ER=X*16
SET X=$ASCII(IN,Y+1)-48
if X>9
SET X=X-7
SET X=X+ER
+2 SET ER=CS+X#256
+3 QUIT
PACK SET Y=X
SET X=""
FOR I=1:1:$LENGTH(Y)
if $ASCII(Y,I)-32
SET X=X_$EXTRACT(Y,I)
+1 if X=""
QUIT
if X'?.P1N.NP
SET X="*"
QUIT
IN SET CNT=^LA(TSK,"I",0)+1
IF '$DATA(^(CNT))
if TOUT>9
QUIT
SET TOUT=TOUT+1
HANG 9
GOTO IN
+1 SET IN=^(CNT)
SET ^(0)=CNT
SET TOUT=0
+2 if IN["~"
SET CTRL=$PIECE(IN,"~",2)
SET IN=$PIECE(IN,"~",1)
+3 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)
+1 ;