XMLSWP2 ;(WASH ISC)/CAP-Sliding Window Protocol ;04/17/2002 10:59
;;8.0;MailMan;;Jun 28, 2002
TRAN Q:$S('$D(XM):1,XM'["D":1,1:0) N I,X,Y,% S X=$P($H,",",2),Y=X\3600_":"_$J(X#3600\60,2)_":"_$J(X#60,2) F I=1:1 Q:Y'[" " S Y=$P(Y," ")_0_$P(Y," ",2,4)
S %=$E(Y_" ",1,$L(XMTRAN)<245*99),%=%_$E(XMTRAN,1,245-$L(%)) U IO(0) W !,% I IO'="" U IO
Q
PROG ;Statistics
I '$D(T) S T=$H*86400+$P($H,",",2)-1
N D,X S D=$S($D(^XMBS(4.2999,XMINST,3))#10:^(3),1:""),$P(D,U,1,6)=$H_U_$S($D(XMZ):XMZ,1:"")_U_I_U_E_U_$J(C/($H*86400+$P($H,",",2)-T),0,2)_U_IO_" SWP" S ^(3)=D,XMLCT=0
Q:$S('$D(XMLIN):1,XMLIN="":1,'G:1,1:0)
S D="Line: "_$P(D,U,3)_", Speed: "_$P(D,U,5) Q:$S('$D(W):1,+W'=W:1,1:0)
S D=D_", Window: "_W_", Out: ",A=0
F X=0:0 S X=$O(W(X)),A=A+1 I '$O(W(X)) S D=D_$O(W(0))_"/"_X Q
S D=D_", Status: "_G_"/"_E X P("I")
Q
PROGS N % S %=1 G PROG
PROGR N % S %=2 G PROG
QQQ S ER=F>9,E=E+1 R X:4 G Q:'$T,QQQ
QQ K W S ER=0
Q K XMLSWPQ S:$D(XMBLOCK) XMS0AJ=J G:'ER R:$O(W(0)) S XMTLER=$S('$D(XMTLER):E,1:XMTLER+E) G U:ER
S:$O(W(0)) XMS0AJ=$O(W(0))-.000001
I G,$D(Z),$P(Z,U)="@" S XMS0AJ="@"
U K W,Y Q:'ER K XMBLOCK Q
R S X=$O(W(0)),V=0,W=$S(W-4>6:W-4,W>6:6,1:W),E=E+1 D E^XMLSWP0 G QQQ:E>199 I 'X S A=0 G W^XMLSWP
S %X=^XMB(3.9,XMZ,2,W(X,0),0) I $E(%X)="." S %X="."_%X
W %X,$C(13),W(X,2),$C(13) S (ER,F)=0,D="Retransmit line "_X X P("S")
K %X H 3 G 2^XMLSWP
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXMLSWP2 1382 printed Nov 22, 2024@17:22:43 Page 2
XMLSWP2 ;(WASH ISC)/CAP-Sliding Window Protocol ;04/17/2002 10:59
+1 ;;8.0;MailMan;;Jun 28, 2002
TRAN if $SELECT('$DATA(XM)
QUIT
NEW I,X,Y,%
SET X=$PIECE($HOROLOG,",",2)
SET Y=X\3600_":"_$JUSTIFY(X#3600\60,2)_":"_$JUSTIFY(X#60,2)
FOR I=1:1
if Y'[" "
QUIT
SET Y=$PIECE(Y," ")_0_$PIECE(Y," ",2,4)
+1 SET %=$EXTRACT(Y_" ",1,$LENGTH(XMTRAN)<245*99)
SET %=%_$EXTRACT(XMTRAN,1,245-$LENGTH(%))
USE IO(0)
WRITE !,%
IF IO'=""
USE IO
+2 QUIT
PROG ;Statistics
+1 IF '$DATA(T)
SET T=$HOROLOG*86400+$PIECE($HOROLOG,",",2)-1
+2 NEW D,X
SET D=$SELECT($DATA(^XMBS(4.2999,XMINST,3))#10:^(3),1:"")
SET $PIECE(D,U,1,6)=$HOROLOG_U_$SELECT($DATA(XMZ):XMZ,1:"")_U_I_U_E_U_$JUSTIFY(C/($HOROLOG*86400+$PIECE($HOROLOG,",",2)-T),0,2)_U_IO_" SWP"
SET ^(3)=D
SET XMLCT=0
+3 if $SELECT('$DATA(XMLIN)
QUIT
+4 SET D="Line: "_$PIECE(D,U,3)_", Speed: "_$PIECE(D,U,5)
if $SELECT('$DATA(W)
QUIT
+5 SET D=D_", Window: "_W_", Out: "
SET A=0
+6 FOR X=0:0
SET X=$ORDER(W(X))
SET A=A+1
IF '$ORDER(W(X))
SET D=D_$ORDER(W(0))_"/"_X
QUIT
+7 SET D=D_", Status: "_G_"/"_E
XECUTE P("I")
+8 QUIT
PROGS NEW %
SET %=1
GOTO PROG
PROGR NEW %
SET %=2
GOTO PROG
QQQ SET ER=F>9
SET E=E+1
READ X:4
if '$TEST
GOTO Q
GOTO QQQ
QQ KILL W
SET ER=0
Q KILL XMLSWPQ
if $DATA(XMBLOCK)
SET XMS0AJ=J
if 'ER
if $ORDER(W(0))
GOTO R
SET XMTLER=$SELECT('$DATA(XMTLER):E,1:XMTLER+E)
if ER
GOTO U
+1 if $ORDER(W(0))
SET XMS0AJ=$ORDER(W(0))-.000001
+2 IF G
IF $DATA(Z)
IF $PIECE(Z,U)="@"
SET XMS0AJ="@"
U KILL W,Y
if 'ER
QUIT
KILL XMBLOCK
QUIT
R SET X=$ORDER(W(0))
SET V=0
SET W=$SELECT(W-4>6:W-4,W>6:6,1:W)
SET E=E+1
DO E^XMLSWP0
if E>199
GOTO QQQ
IF 'X
SET A=0
GOTO W^XMLSWP
+1 SET %X=^XMB(3.9,XMZ,2,W(X,0),0)
IF $EXTRACT(%X)="."
SET %X="."_%X
+2 WRITE %X,$CHAR(13),W(X,2),$CHAR(13)
SET (ER,F)=0
SET D="Retransmit line "_X
XECUTE P("S")
+3 KILL %X
HANG 3
GOTO 2^XMLSWP