Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: LAKERM3

LAKERM3.m

Go to the documentation of this file.
  1. LAKERM3 ;SLC/RWF/DLG - UNPACK KERMIT RECORDS VIA LSI ;7/20/90 09:26 ;
  1. ;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
  1. ;Call with TSK = instrument
  1. ;Used to unpack kermit records from ^LA(tsk,"O",n) to ^LA(tsk,"C",n).
  1. ;See LAEKT7B for example of use.
  1. A S:'$D(LAKDEM) LAKDEM=$C(13) S:'$D(LAKMAX) LAKMAX=124 S:'$D(^LA(TSK,"C")) ^LA(TSK,"C")=0,^("C",0)=0 S R1=^LA(TSK,"C"),R2="",LAKQCTL="#"
  1. F LOOP=0:0 D GET Q:LOOP!TOUT D:'LAKERR @LATYPE,STORE
  1. Q
  1. GET S LAKERR=0,OUT=""
  1. S CNT=^LA(TSK,"I",0)+1 IF '$D(^(CNT)) S TOUT=TOUT+1 Q:TOUT>9 H 10 G GET
  1. S ^LA(TSK,"I",0)=CNT,IN=^(CNT),TOUT=0
  1. S:$E(IN,$L(IN)-1)="~" CTRL=$P(IN,"~",2),IN=$P(IN,"~",1)
  1. S LATYPE=$E(IN,3) I "SYFDEBZ"'[$E(LATYPE_" ") S LAKERR=1 Q
  1. Q
  1. S S OUT="" Q:$L(IN)'>8 S LAKQCTL=$E(IN,9),R1=^LA(TSK,"C") Q ;Start of secion.
  1. Y S LOOP=0,LAKERR=1 Q ;Y records from download.
  1. F S OUT="",R2="FILE:"_$E(IN,4,$L(IN)-1),R1=^LA(TSK,"C") D OUT Q ;File header
  1. D S OUT=$E(IN,4,$L(IN)-1) D:OUT[LAKQCTL QCTL Q
  1. E S ^LA(TSK,"C")=R1,OUT="" Q ;Error, discard data back to last good file
  1. B ;End of transmision
  1. Z S LOOP=1 D OUT:R2]"" Q
  1. QCTL ;Unquote control's
  1. F I1=0:0 S I1=$F(OUT,LAKQCTL,I1) Q:I1<1 S X=$E(OUT,I1),C=$C($A(X)-32),OUT=$E(OUT,1,I1-2)_$S(X=LAKQCTL:X,1:C)_$E(OUT,I1+1,299)
  1. Q
  1. STORE D OUT:$L(R2)+$L(OUT)>LAKMAX S R2=R2_OUT I R2[LAKDEM S OUT=$P(R2,LAKDEM,2,99),R2=$P(R2,LAKDEM,1)_LAKDEM D OUT S R2=OUT
  1. Q
  1. OUT S CNT=^LA(TSK,"C")+1,^("C")=CNT,^("C",CNT)=R2,R2=""
  1. Q