LAABL500 ; IHS/DIR/FJE - RADIOMETER ABL500,505,520 5/27/93 07:00 ;
;;5.2;LA;;NOV 01, 1997
;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
;CROSS LINK BY ID = ACCESSION #,IDE=INTERNAL SEQUENCE #
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)) D ^LASET Q:'TSK S X="TRAP^"_LANM,@^%ZOSF("TRAP")
S I=0 F S I=$O(TC(I)) Q:I<1 D
.S TEST(TC(I,4))=TC(I,1),FIX(TC(I,4))=TC(I,2)
LA2 K Y,TV,ID,IDE S (A,TOUT)=0 D IN G QUIT:TOUT,ID:$E(IN)="P",LA2
ID ;sets ID from the accession # in the 4th piece of the "P" string ("|")
S V=$P(IN,"|",4) D NUM S ID=+V D IN G QUIT:TOUT
IDE ;sets IDE from the 2nd piece of the "O" string ("^")
I $P(IN,"|")="O" S V=$P(IN,"^",2) D NUM S IDE=+V
RES ;sets TEST and values from the "R" string
S TOUT=0 D IN G QUIT:TOUT,LA3:$E(IN)="L"
S V=$P($P(IN,"^",4),"|") D NUM S TEST=V G RES:TEST=""!('$D(TEST(TEST)))
S V=$P(IN,"|",4) D NUM,FIX S:V="....." V="" S @TEST(TEST)=V G RES
Q
LA3 ;moving data to LAH global
X LAGEN G LA2:ISQN<1
F I=0:0 S I=$O(TV(I)) Q:I<1 I $D(TV(I,1)),TV(I,1)]"" S ^LAH(LWL,1,ISQN,I)=TV(I,1)
G LA2
Q
IN S CNT=^LA(TSK,"I",0)+1 I '$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
NUM S X="" F I=1:1:$L(V) S:$A(V,I)-32 X=X_$E(V,I)
S V=X Q
QUIT LOCK ^LA(TSK) H 1 K ^LA(TSK),^LA("LOCK",TSK) D
.K X,A,ID,IDE,BAD,CNT,I,JJ,LAGEN,IN,ISQN,LANM,LWL,T,TEST,TC,TV,TOUT,TSK,V,CTRL,FIX
.S:$D(ZTQUEUED) ZTREQ="@"
Q
TRAP D ^LABERR S T=TSK D SET^LAB G @("LA2^"_LANM) ;ERROR TRAP
FIX ;allows site to utilize param 1 for result manipulation
I $D(FIX(TEST)) X FIX(TEST)
Q
LAABL500 ; IHS/DIR/FJE - RADIOMETER ABL500,505,520 5/27/93 07:00 ;
+1 ;;5.2;LA;;NOV 01, 1997
+2 ;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
+3 ;CROSS LINK BY ID = ACCESSION #,IDE=INTERNAL SEQUENCE #
LA1 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
SET LANM=$TEXT(+0)
SET TSK=$ORDER(^LAB(62.4,"C",LANM,0))
SET U="^"
IF TSK<1
QUIT
+1 IF '$DATA(^LA(TSK,"I",0))
QUIT
DO ^LASET
IF 'TSK
QUIT
SET X="TRAP^"_LANM
SET @^%ZOSF("TRAP")
+2 SET I=0
FOR
SET I=$ORDER(TC(I))
IF I<1
QUIT
Begin DoDot:1
+3 SET TEST(TC(I,4))=TC(I,1)
SET FIX(TC(I,4))=TC(I,2)
End DoDot:1
LA2 KILL Y,TV,ID,IDE
SET (A,TOUT)=0
DO IN
IF TOUT
GOTO QUIT
IF $EXTRACT(IN)="P"
GOTO ID
GOTO LA2
ID ;sets ID from the accession # in the 4th piece of the "P" string ("|")
+1 SET V=$PIECE(IN,"|",4)
DO NUM
SET ID=+V
DO IN
IF TOUT
GOTO QUIT
IDE ;sets IDE from the 2nd piece of the "O" string ("^")
+1 IF $PIECE(IN,"|")="O"
SET V=$PIECE(IN,"^",2)
DO NUM
SET IDE=+V
RES ;sets TEST and values from the "R" string
+1 SET TOUT=0
DO IN
IF TOUT
GOTO QUIT
IF $EXTRACT(IN)="L"
GOTO LA3
+2 SET V=$PIECE($PIECE(IN,"^",4),"|")
DO NUM
SET TEST=V
IF TEST=""!('$DATA(TEST(TEST)))
GOTO RES
+3 SET V=$PIECE(IN,"|",4)
DO NUM
DO FIX
IF V="....."
SET V=""
SET @TEST(TEST)=V
GOTO RES
+4 QUIT
LA3 ;moving data to LAH global
+1 XECUTE LAGEN
IF ISQN<1
GOTO LA2
+2 FOR I=0:0
SET I=$ORDER(TV(I))
IF I<1
QUIT
IF $DATA(TV(I,1))
IF TV(I,1)]""
SET ^LAH(LWL,1,ISQN,I)=TV(I,1)
+3 GOTO LA2
+4 QUIT
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
NUM SET X=""
FOR I=1:1:$LENGTH(V)
IF $ASCII(V,I)-32
SET X=X_$EXTRACT(V,I)
+1 SET V=X
QUIT
QUIT LOCK ^LA(TSK)
HANG 1
KILL ^LA(TSK),^LA("LOCK",TSK)
Begin DoDot:1
+1 KILL X,A,ID,IDE,BAD,CNT,I,JJ,LAGEN,IN,ISQN,LANM,LWL,T,TEST,TC,TV,TOUT,TSK,V,CTRL,FIX
+2 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
End DoDot:1
+3 QUIT
TRAP ;ERROR TRAP
DO ^LABERR
SET T=TSK
DO SET^LAB
GOTO @("LA2^"_LANM)
FIX ;allows site to utilize param 1 for result manipulation
+1 IF $DATA(FIX(TEST))
XECUTE FIX(TEST)
+2 QUIT