source: WorldVistAEHR/trunk/r/AUTOMATED_LAB_INSTRUMENTS-LA/LADKERM3.m@ 1389

Last change on this file since 1389 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 1.4 KB
Line 
1LADKERM3 ;SLC/RWF/DLG - UNPACK KERMIT RECORDS ;12/6/89 09:24 ;
2 ;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
3 ;Call with TSK = instrument
4 ;Used to unpack kermit records from ^LA(tsk,"O",n) to ^LA(tsk,"C",n).
5 ;See LAEKT7B for example of use.
6A 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="#"
7 F LOOP=0:0 D GET Q:LOOP!TOUT D:'LAKERR @LATYPE,STORE
8 Q
9GET S LAKERR=0,OUT=""
10 S CNT=^LA(TSK,"I",0)+1 IF '$D(^(CNT)) S TOUT=TOUT+1 Q:TOUT>9 H 10 G GET
11 S ^LA(TSK,"I",0)=CNT,IN=^(CNT),TOUT=0
12 S:$E(IN,$L(IN)-1)="~" CTRL=$P(IN,"~",2),IN=$P(IN,"~",1)
13 S LATYPE=$E(IN,3) I "SYFDEBZ"'[$E(LATYPE_" ") S LAKERR=1 Q
14 Q
15S S OUT="" Q:$L(IN)'>8 S LAKQCTL=$E(IN,9),R1=^LA(TSK,"C") Q ;Start of secion.
16Y S LOOP=0,LAKERR=1 Q ;Y records from download.
17F S OUT="",R2="FILE:"_$E(IN,4,$L(IN)-1),R1=^LA(TSK,"C") D OUT Q ;File header
18D S OUT=$E(IN,4,$L(IN)-1) D:OUT[LAKQCTL QCTL Q
19E S ^LA(TSK,"C")=R1,OUT="" Q ;Error, discard data back to last good file
20B ;End of transmision
21Z S LOOP=1 D OUT:R2]"" Q
22QCTL ;Unquote control's
23 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)
24 Q
25STORE 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
26 Q
27OUT S CNT=^LA(TSK,"C")+1,^("C")=CNT,^("C",CNT)=R2,R2=""
28 Q
Note: See TracBrowser for help on using the repository browser.