- LADMND ; IHS/DIR/FJE - DEMAND ANALYZER IN MODE 3 7/20/90 08:06 ;
- ;;5.2;LA;;NOV 01, 1997
- ;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
- ;CROSS LINK BY ID OR IDE
- ;Internal entry # for CHEM TESTS field in auto instrument file must match the identifying # for each test.
- 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))
- S LRTOP=$P(^LAB(69.9,1,1),"^",3) D ^LASET Q:'TSK S X="TRAP^"_LANM,@^%ZOSF("TRAP"),PSEQ=0,ID=0
- LA2 S TOUT=0,BAD=0 D IN G QUIT:TOUT,LA2:IN="",LA2:$E(IN,1)'="D" S SEQ=$E(IN,2,5) ;D SEND:SEQ'=PSEQ
- F IX=17:13 S V=$E(IN,IX+2,IX+10),I=+$E(IN,IX,IX+1) Q:I<1 I $D(TC(I)) X TC(I,2) S @TC(I,1)=V ;V COULD BE MODIFIED ON THIS LINE
- I PSEQ'=SEQ S ID=+$E(IN,2,5),TRAY=1,CUP=+ID,V=$E(IN,6,16),IDE=+V
- D SAVE:ID S PSEQ=SEQ K TV G LA2
- SAVE I PSEQ'=SEQ X LAGEN
- F I=0:0 S I=$O(TV(I)) Q:I<1 I TV(I,1)]"" S X=TV(I,1) D PACK S ^LAH(LWL,1,ISQN,I)=+X
- Q
- QC ;QC TESTING HERE; S BAD=1 IF DONT STORE
- F I=6:13 Q:I>$L(IN) S T=+$E(IN,I,I+1),X=$E(IN,I+2,I+10),F=$E(IN,I+11,I+12) D QC3:T=66,QC2
- Q
- QC2 Q:'$D(TC(T)) S X="" F J=1:1:$L(V) S:$A(V,J)>32 X=X_$E(V,J)
- S @TC(T,1)=V Q
- QC3 F K="L","I","H" F L=0:0 S L=$O(TC(L)) Q:L<1 I TC(L,2)="66"_K S T=L D QC2
- S T=0 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)=TSK_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)
- Q
- TRAP D ^LABERR S T=TSK D SET^LAB G @("LA2^"_LANM) ;ERROR TRAP
- Q
- PACK S Y=X,X="" F J=1:1:$L(Y) S:$A(Y,J)-32 X=X_$E(Y,J)
- Q:X="" W:X'?.P1N.NP X="*" Q
- LADMND ; IHS/DIR/FJE - DEMAND ANALYZER IN MODE 3 7/20/90 08:06 ;
- +1 ;;5.2;LA;;NOV 01, 1997
- +2 ;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
- +3 ;CROSS LINK BY ID OR IDE
- +4 ;Internal entry # for CHEM TESTS field in auto instrument file must match the identifying # for each test.
- 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 SET LRTOP=$PIECE(^LAB(69.9,1,1),"^",3)
- DO ^LASET
- IF 'TSK
- QUIT
- SET X="TRAP^"_LANM
- SET @^%ZOSF("TRAP")
- SET PSEQ=0
- SET ID=0
- LA2 ;D SEND:SEQ'=PSEQ
- SET TOUT=0
- SET BAD=0
- DO IN
- IF TOUT
- GOTO QUIT
- IF IN=""
- GOTO LA2
- IF $EXTRACT(IN,1)'="D"
- GOTO LA2
- SET SEQ=$EXTRACT(IN,2,5)
- +1 ;V COULD BE MODIFIED ON THIS LINE
- FOR IX=17:13
- SET V=$EXTRACT(IN,IX+2,IX+10)
- SET I=+$EXTRACT(IN,IX,IX+1)
- IF I<1
- QUIT
- IF $DATA(TC(I))
- XECUTE TC(I,2)
- SET @TC(I,1)=V
- +2 IF PSEQ'=SEQ
- SET ID=+$EXTRACT(IN,2,5)
- SET TRAY=1
- SET CUP=+ID
- SET V=$EXTRACT(IN,6,16)
- SET IDE=+V
- +3 IF ID
- DO SAVE
- SET PSEQ=SEQ
- KILL TV
- GOTO LA2
- SAVE IF PSEQ'=SEQ
- XECUTE LAGEN
- +1 FOR I=0:0
- SET I=$ORDER(TV(I))
- IF I<1
- QUIT
- IF TV(I,1)]""
- SET X=TV(I,1)
- DO PACK
- SET ^LAH(LWL,1,ISQN,I)=+X
- +2 QUIT
- QC ;QC TESTING HERE; S BAD=1 IF DONT STORE
- +1 FOR I=6:13
- IF I>$LENGTH(IN)
- QUIT
- SET T=+$EXTRACT(IN,I,I+1)
- SET X=$EXTRACT(IN,I+2,I+10)
- SET F=$EXTRACT(IN,I+11,I+12)
- IF T=66
- DO QC3
- DO QC2
- +2 QUIT
- QC2 IF '$DATA(TC(T))
- QUIT
- SET X=""
- FOR J=1:1:$LENGTH(V)
- IF $ASCII(V,J)>32
- SET X=X_$EXTRACT(V,J)
- +1 SET @TC(T,1)=V
- QUIT
- QC3 FOR K="L","I","H"
- FOR L=0:0
- SET L=$ORDER(TC(L))
- IF L<1
- QUIT
- IF TC(L,2)="66"_K
- SET T=L
- DO QC2
- +1 SET T=0
- 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)=TSK_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)
- +1 QUIT
- TRAP ;ERROR TRAP
- DO ^LABERR
- SET T=TSK
- DO SET^LAB
- GOTO @("LA2^"_LANM)
- +1 QUIT
- PACK SET Y=X
- SET X=""
- FOR J=1:1:$LENGTH(Y)
- IF $ASCII(Y,J)-32
- SET X=X_$EXTRACT(Y,J)
- +1 IF X=""
- QUIT
- IF X'?.P1N.NP
- WRITE X="*"
- QUIT