- LAHTRK ; IHS/DIR/FJE - HEMATRAK 590 DIFF COUNTER 8/16/90 14:18 ;
- ;;5.2;LA;;NOV 01, 1997
- ;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
- LA S:$D(ZTQUEUED) ZTREQ="@" S LANM=$T(+0),TSK=$O(^LAB(62.4,"C","LAHTRK",0)) Q:TSK<1
- Q:'$D(^LA(TSK,"I",0))
- S U="^",SS="CH" D ^LASET Q:'TSK S X="TRAP^"_LANM,@^%ZOSF("TRAP")
- S ZZ="3,9,9,6^6,1,1,1,2,4,4^14,3,3,3,3,3,3,3,3,3,3,3,3,3,4^35,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3^2,4,3^4,3,3,3,3^"
- S CNT=0,U="^"
- LA2 S A=1,TOUT=0 D IN G QUIT:TOUT S Y(1)=IN,LOG=$E(IN,1,9) G LA2:LOG="" S LOG=+LOG
- F A=2:1:6 D IN G QUIT:TOUT S Y(A)=IN
- SAVE F A=1:1:6 D PIEC
- S SPEC=$P(^LAB(69.9,1,1),U,1),METH="HTRAK"
- LA3 X LAGEN G LA2:ISQN<1
- S Z3="",Z4="",Z5="",Z=LRVAL K LRVAL
- F I=12:1:17 S VAL=$P(Z,U,I)/10,Z3=Z3_$S(VAL=0:"",1:VAL)_U
- F I=20:1:24 S VAL=$P(Z,U,I)/10,Z4=Z4_$S(VAL=0:"",1:VAL)_U
- S VAL=+$P(Z,U,40),Z5=$S(VAL=1:"R",VAL=2:"A",VAL=3:"I",1:"")_U_U_U F I=28:1:33 S VAL=+$P(Z,U,I),Z5=Z5_$S(VAL=0:"",1:VAL-3)_U
- S Z5=Z5_$S(+$P(Z,U,35)=0:"",1:+$P(Z,U,35)-3) S Z14=$S(+$P(Z,U,18)=0:"",1:+$P(Z,U,18)\10)_U_$S(+$P(Z,U,19)=0:"",1:+$P(Z,U,19)\10)_U
- S Z14=Z14_$S(+$P(Z,U,34)=0:"",1:+$P(Z,U,34)-3)_U F I=36:1:39 S VAL=+$P(Z,U,I),Z14=Z14_$S(VAL=0:"",1:VAL-3)_U
- ;F I=66:1:69 S VAL=+$P(Z,U,I),Z14=Z14_$S(VAL=0:"",1:VAL)_U
- S NCYT=$S($P(Z5,U,4)=""&($P(Z5,U,5)="")&($P(Z5,U,6)="")&($P(Z5,U,7)="")&($P(Z5,U,10)="")&($P(Z14,U,3)=""):"Y",1:"N"),NCHR=$S($P(Z5,U,8)=""&($P(Z5,U,9)="")&($P(Z14,U,4)=""):"Y",1:"N")
- S Z5=$P(Z5,U,1)_U_NCYT_U_NCHR_U_$P(Z5,U,4,99)
- S X=$D(^LAH(LWL,1,ISQN,0)) ;INSURE NAKED IS SET FOR REST OF FOR LOOP SPEED CODE
- F I=1:1:6 S:$L($P(Z3,U,I)) ^(393+I)=$P(Z3,U,I)
- F I=1:1:5 S:$L($P(Z4,U,I)) ^(399+I)=$P(Z4,U,I)
- F I=1:1:22 S:$L($P(Z5,U,I)) ^(404+I)=$P(Z5,U,I)
- F I=1:1:11 S:$L($P(Z14,U,I)) ^(470+I)=$P(Z14,U,I)
- G LA2
- PIEC S DES=$P(ZZ,U,A),FS=1+DES,L=0 F I=2:1:FS D PART
- Q
- PART S F=L+1,L=$P(DES,",",I)+L,Z=Z_$E(Y(A),F,L)_U Q
- IN S CNT=^LA(TSK,"I",0)+1 IF '$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
- 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
- LAHTRK ; IHS/DIR/FJE - HEMATRAK 590 DIFF COUNTER 8/16/90 14:18 ;
- +1 ;;5.2;LA;;NOV 01, 1997
- +2 ;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
- LA IF $DATA(ZTQUEUED)
- SET ZTREQ="@"
- SET LANM=$TEXT(+0)
- SET TSK=$ORDER(^LAB(62.4,"C","LAHTRK",0))
- IF TSK<1
- QUIT
- +1 IF '$DATA(^LA(TSK,"I",0))
- QUIT
- +2 SET U="^"
- SET SS="CH"
- DO ^LASET
- IF 'TSK
- QUIT
- SET X="TRAP^"_LANM
- SET @^%ZOSF("TRAP")
- +3 SET ZZ="3,9,9,6^6,1,1,1,2,4,4^14,3,3,3,3,3,3,3,3,3,3,3,3,3,4^35,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3^2,4,3^4,3,3,3,3^"
- +4 SET CNT=0
- SET U="^"
- LA2 SET A=1
- SET TOUT=0
- DO IN
- IF TOUT
- GOTO QUIT
- SET Y(1)=IN
- SET LOG=$EXTRACT(IN,1,9)
- IF LOG=""
- GOTO LA2
- SET LOG=+LOG
- +1 FOR A=2:1:6
- DO IN
- IF TOUT
- GOTO QUIT
- SET Y(A)=IN
- SAVE FOR A=1:1:6
- DO PIEC
- +1 SET SPEC=$PIECE(^LAB(69.9,1,1),U,1)
- SET METH="HTRAK"
- LA3 XECUTE LAGEN
- IF ISQN<1
- GOTO LA2
- +1 SET Z3=""
- SET Z4=""
- SET Z5=""
- SET Z=LRVAL
- KILL LRVAL
- +2 FOR I=12:1:17
- SET VAL=$PIECE(Z,U,I)/10
- SET Z3=Z3_$SELECT(VAL=0:"",1:VAL)_U
- +3 FOR I=20:1:24
- SET VAL=$PIECE(Z,U,I)/10
- SET Z4=Z4_$SELECT(VAL=0:"",1:VAL)_U
- +4 SET VAL=+$PIECE(Z,U,40)
- SET Z5=$SELECT(VAL=1:"R",VAL=2:"A",VAL=3:"I",1:"")_U_U_U
- FOR I=28:1:33
- SET VAL=+$PIECE(Z,U,I)
- SET Z5=Z5_$SELECT(VAL=0:"",1:VAL-3)_U
- +5 SET Z5=Z5_$SELECT(+$PIECE(Z,U,35)=0:"",1:+$PIECE(Z,U,35)-3)
- SET Z14=$SELECT(+$PIECE(Z,U,18)=0:"",1:+$PIECE(Z,U,18)\10)_U_$SELECT(+$PIECE(Z,U,19)=0:"",1:+$PIECE(Z,U,19)\10)_U
- +6 SET Z14=Z14_$SELECT(+$PIECE(Z,U,34)=0:"",1:+$PIECE(Z,U,34)-3)_U
- FOR I=36:1:39
- SET VAL=+$PIECE(Z,U,I)
- SET Z14=Z14_$SELECT(VAL=0:"",1:VAL-3)_U
- +7 ;F I=66:1:69 S VAL=+$P(Z,U,I),Z14=Z14_$S(VAL=0:"",1:VAL)_U
- +8 SET NCYT=$SELECT($PIECE(Z5,U,4)=""&($PIECE(Z5,U,5)="")&($PIECE(Z5,U,6)="")&($PIECE(Z5,U,7)="")&($PIECE(Z5,U,10)="")&($PIECE(Z14,U,3)=""):"Y",1:"N")
- SET NCHR=$SELECT($PIECE(Z5,U,8)=""&($PIECE(Z5,U,9)="")&($PIECE(Z14,U,4)=""):"Y",1:"N")
- +9 SET Z5=$PIECE(Z5,U,1)_U_NCYT_U_NCHR_U_$PIECE(Z5,U,4,99)
- +10 ;INSURE NAKED IS SET FOR REST OF FOR LOOP SPEED CODE
- SET X=$DATA(^LAH(LWL,1,ISQN,0))
- +11 FOR I=1:1:6
- IF $LENGTH($PIECE(Z3,U,I))
- SET ^(393+I)=$PIECE(Z3,U,I)
- +12 FOR I=1:1:5
- IF $LENGTH($PIECE(Z4,U,I))
- SET ^(399+I)=$PIECE(Z4,U,I)
- +13 FOR I=1:1:22
- IF $LENGTH($PIECE(Z5,U,I))
- SET ^(404+I)=$PIECE(Z5,U,I)
- +14 FOR I=1:1:11
- IF $LENGTH($PIECE(Z14,U,I))
- SET ^(470+I)=$PIECE(Z14,U,I)
- +15 GOTO LA2
- PIEC SET DES=$PIECE(ZZ,U,A)
- SET FS=1+DES
- SET L=0
- FOR I=2:1:FS
- DO PART
- +1 QUIT
- PART SET F=L+1
- SET L=$PIECE(DES,",",I)+L
- SET Z=Z_$EXTRACT(Y(A),F,L)_U
- 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
- 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)