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

XMLPC.m

Go to the documentation of this file.
XMLPC ;(WASH ISC)/CAP-Protocol 4 PC Platforms ;03/27/2002  15:54
 ;;8.0;MailMan;;Jun 28, 2002
SEND ;returns ER(0 OR 1), XMLER=number of "soft" errors
 S (XMLER,XMLZ,XMTLER)=0 I $L(XMSG)>255 S ER=1 G SRQ
 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
 D SRINIT S X=XMSG D SUM
 I $G(XMINST) D XMTSTAT^XMTDR(XMINST,"S",XMSG,0) ; PC1
SL S XMLER=XMLER+1 I XMLER>XMLMAXER S ER=1 G SRQ
 W "~*~^",$C(13),XMSG,$C(13),XMLINE,U,XMSUM,$C(13)
SA R XMLX:XMLTIME I XMLX?.E1"ACK" W XMLX_$C(13) G SRQ:XMLX-XMLINE=0,SA
 S XMLZ=XMLZ+1 I XMLZ>XMLMAXER S ER=1 G SRQ
 G SL
REC ;SEE SEND
 D SRINIT
 I $D(XMRG),$G(XMINST) D XMTSTAT^XMTDR(XMINST,"R",XMRG,0) ; PC1
RL S XMLER=XMLER+1 I XMLER>XMLMAXER S ER=1 G SRQ
 R X:XMLTIME I X'="~*~^" G RL
 R XMRG#255:$S($D(XMSTIME):XMSTIME,1:XMLTIME)
 I $E(XMRG,1,5)=" ~*~^" S XMRG=$E(XMRG,2,$L(XMRG))
 R XMLY:XMLTIME
 I +XMLY-XMLINE<0 S X=$$ACK(+XMLY_"ACK") G RL
 S X=XMRG D SUM S XMLZ=XMSUM=$P(XMLY,U,2)
 S X=$$ACK(XMLINE_"ACK"),(XMLER,XMTLER)=0
 G SRQ:X=1 S ER=1 G SRQ
ACK(Y) N X,I S I=0
AA S I=I+1 I I>30 Q 0
 W Y_$C(13) R X:XMLTIME
 G AA:X'=Y
 Q 1
SRINIT ;
 S XMLINE=$S('$D(XMLINE):1,1:XMLINE+1)
 S XMLENQ=$C(9)_"ENQ"_$C(9),XMLERR=$C(9)_"ERROR"_$C(9)
 S XMLER=-1 ;soft error count
 S XMLMAXER=500 ;maximum allowable soft errors
 S XMLTIME=9 ;length of READ time
 S ER=0 ;non-recoverable error flag
 Q
SRQ ;Exit from Send/Receive
 S XMTLER=$S('$D(XMTLER):XMLER,1:XMTLER+XMLER) ;Total errors
 K XMLERR,XMLMAXER,XMLTIME,XMLX,XMLY,XMLZ
 Q
SUM ;Calculate checksum
 I '$D(XMOS) D LPC^XMLSWP0
 I $D(XMOS(0)) X XMOS(0) S XMSUM=Y Q
 S XMSUM=$A(X) Q:$L(X)=1  S I=1
A S I=I+1 I $L(X)<I K %,%0,%1 S XMSUM=XMSUM+$L(X)*$L(X) Q
 S Y=$A(X,I) F %=256:0 Q:%\4<Y  S %=%\2
B S %0=XMSUM#%,%=%\2 G A:%=0 S %0=%0\%,%1=Y\% I %1=1 S Y=Y-%
 G B:%1+%0=0 I %1'=%0 S:%0=0 XMSUM=XMSUM+% G B
 G B:%0=0 S XMSUM=XMSUM-%
 G B
OPEN ;SET DEVICE PARAMETERS
 N X S X=$G(^%ZOSF("OS")) I X["VAX" S X=0 X ^%ZOSF("RM") U IO:PACK
 I X["DTM" U IO:WRAP=0
 Q