source: WorldVistAEHR/trunk/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/XUSC1S1.m@ 701

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

initial load of WorldVistAEHR

File size: 1.2 KB
Line 
1XUSC1S1 ;ISCSF/RWF - Read data ;04/01/2002 17:13
2 ;;8.0;KERNEL;**283**;Jul 10, 1995
3 Q
4DATA(ROOT,STAT) ;get Data
5 N I,M
6 D DCODE(XUSCDAT),TRACE^XUSC1S("DECODE "_XUSCDAT)
7 ;Check if data type is OK
8 ;I ...
9 F I=1:1 S M=$$DREAD() Q:XUSCER!M S @ROOT@(I)=XUSCDAT
10 ;If we got it all
11 D SEND^XUSC1S($S(XUSCER:"500 Data error",1:"220 OK"))
12 Q
13 ;
14SDATA(ROOT,TYPE) ;Send data from a source
15 N X,Y,L,D
16 S ROOT=$NA(@ROOT),X=ROOT,Y=$E(ROOT,1,$L(ROOT)-1),XUSCER=0
17 D SEND^XUSC1S("DATA PARAM="_TYPE)
18 S X=ROOT
19 F S X=$Q(@X) Q:$E(X,1,$L(Y))'=Y D DSEND(@X)
20 D ESEND ;Tell other end we'r done
21 Q
22DCODE(D) ;Decode a DATA string
23 S D=$$UP^XLFSTR(D),D=$P(D,"PARAM=",2,99)
24 F I=1:1 S STAT("P"_I)=$P(D,",",I) Q:$P(D,",",I+1)=""
25 Q
26DREAD() ;Data read
27 N L,D,R S (D,XUSCDAT)="",XUSCER=0
28 S L=$$LREAD(3) Q:XUSCER 1
29 I L<0 S XUSCDAT="" Q 1
30 I L'?3N S XUSCER="1 Out of sync: "_L Q 1
31 I L>0 S XUSCDAT=$$LREAD(L)
32 Q 0
33DSEND(D) ;Data send
34 N L
35 S L=$L(D),L=$E(1000+L,2,4)
36 W L,D,! ;Flush buffer
37 Q
38ESEND ;Send end of data message
39 W "-10",!
40 Q
41LREAD(N) ;Read N char
42 N D,C,P S D="",C=N,XUSCER=0
43 F D Q:'C!XUSCER
44 . R P#C:XUSCTIME E S XUSCER=1 Q
45 . D TRACE^XUSC1S("LREAD "_$A(P)) ;*rwf
46 . S D=D_P,C=N-$L(D)
47 . Q
48 Q D
Note: See TracBrowser for help on using the repository browser.