source: FOIAVistA/trunk/r/MAILMAN-XM/XMLPC.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 2.0 KB
Line 
1XMLPC ;(WASH ISC)/CAP-Protocol 4 PC Platforms ;03/27/2002 15:54
2 ;;8.0;MailMan;;Jun 28, 2002
3SEND ;returns ER(0 OR 1), XMLER=number of "soft" errors
4 S (XMLER,XMLZ,XMTLER)=0 I $L(XMSG)>255 S ER=1 G SRQ
5 I XMSG'?.ANP F %=1:1:$L(XMSG) I $E(XMSG,%)?1C,$A(XMSG,%)'=9 S XMSG=$E(XMSG,1,%-1)_$E(XMSG,%+1,999) Q:XMSG?.ANP S %=%-1
6 D SRINIT S X=XMSG D SUM
7 I $G(XMINST) D XMTSTAT^XMTDR(XMINST,"S",XMSG,0) ; PC1
8SL S XMLER=XMLER+1 I XMLER>XMLMAXER S ER=1 G SRQ
9 W "~*~^",$C(13),XMSG,$C(13),XMLINE,U,XMSUM,$C(13)
10SA R XMLX:XMLTIME I XMLX?.E1"ACK" W XMLX_$C(13) G SRQ:XMLX-XMLINE=0,SA
11 S XMLZ=XMLZ+1 I XMLZ>XMLMAXER S ER=1 G SRQ
12 G SL
13REC ;SEE SEND
14 D SRINIT
15 I $D(XMRG),$G(XMINST) D XMTSTAT^XMTDR(XMINST,"R",XMRG,0) ; PC1
16RL S XMLER=XMLER+1 I XMLER>XMLMAXER S ER=1 G SRQ
17 R X:XMLTIME I X'="~*~^" G RL
18 R XMRG#255:$S($D(XMSTIME):XMSTIME,1:XMLTIME)
19 I $E(XMRG,1,5)=" ~*~^" S XMRG=$E(XMRG,2,$L(XMRG))
20 R XMLY:XMLTIME
21 I +XMLY-XMLINE<0 S X=$$ACK(+XMLY_"ACK") G RL
22 S X=XMRG D SUM S XMLZ=XMSUM=$P(XMLY,U,2)
23 S X=$$ACK(XMLINE_"ACK"),(XMLER,XMTLER)=0
24 G SRQ:X=1 S ER=1 G SRQ
25ACK(Y) N X,I S I=0
26AA S I=I+1 I I>30 Q 0
27 W Y_$C(13) R X:XMLTIME
28 G AA:X'=Y
29 Q 1
30SRINIT ;
31 S XMLINE=$S('$D(XMLINE):1,1:XMLINE+1)
32 S XMLENQ=$C(9)_"ENQ"_$C(9),XMLERR=$C(9)_"ERROR"_$C(9)
33 S XMLER=-1 ;soft error count
34 S XMLMAXER=500 ;maximum allowable soft errors
35 S XMLTIME=9 ;length of READ time
36 S ER=0 ;non-recoverable error flag
37 Q
38SRQ ;Exit from Send/Receive
39 S XMTLER=$S('$D(XMTLER):XMLER,1:XMTLER+XMLER) ;Total errors
40 K XMLERR,XMLMAXER,XMLTIME,XMLX,XMLY,XMLZ
41 Q
42SUM ;Calculate checksum
43 I '$D(XMOS) D LPC^XMLSWP0
44 I $D(XMOS(0)) X XMOS(0) S XMSUM=Y Q
45 S XMSUM=$A(X) Q:$L(X)=1 S I=1
46A S I=I+1 I $L(X)<I K %,%0,%1 S XMSUM=XMSUM+$L(X)*$L(X) Q
47 S Y=$A(X,I) F %=256:0 Q:%\4<Y S %=%\2
48B S %0=XMSUM#%,%=%\2 G A:%=0 S %0=%0\%,%1=Y\% I %1=1 S Y=Y-%
49 G B:%1+%0=0 I %1'=%0 S:%0=0 XMSUM=XMSUM+% G B
50 G B:%0=0 S XMSUM=XMSUM-%
51 G B
52OPEN ;SET DEVICE PARAMETERS
53 N X S X=$G(^%ZOSF("OS")) I X["VAX" S X=0 X ^%ZOSF("RM") U IO:PACK
54 I X["DTM" U IO:WRAP=0
55 Q
Note: See TracBrowser for help on using the repository browser.