From:	MERC::"uunet!CRVAX.SRI.COM!RELAY-INFO-VAX"  8-MAY-1992 21:27:27.62
To:	INFO-VAX@SRI.COM
CC:	
Subj:	DECserver 300 parser for messages re-Xmit & dups received

I wrote the following Q&D (so it's sloppy and a mess) program that generates 
the a report similar to the following:

Server: EARTH
  Transmit:   25269  Retransmit:      47   (msgs per re-Xmit=   537)  NOT OKAY
  Recieved:   29312  Dup. Rc'vd:      97   (msgs per duplic=    302)  NOT OKAY

Server: GEMINI
  Transmit:    9981  Retransmit:      13   (msgs per re-Xmit=   767)  NOT OKAY
  Recieved:   11773  Dup. Rc'vd:      10   (msgs per duplic=   1177)  Okay

Server: LEO
  Transmit:    7824  Retransmit:      12   (msgs per re-Xmit=   652)  NOT OKAY
  Recieved:    9077  Dup. Rc'vd:       7   (msgs per duplic=   1296)  Okay

Server: LIBRA
  Transmit:    7850  Retransmit:      13   (msgs per re-Xmit=   603)  NOT OKAY
  Recieved:    9241  Dup. Rc'vd:       4   (msgs per duplic=   2310)  Okay


which is useful to find problem areas of your network.

It was written for TSM V1.5 and DECserver 300 software V2.1, and may require
modification for other terminal servers or versions of TSM.

-Dan Wing, DWING@UH01.Colorado.EDU, WING_D@UCOLMCC.BITNET
 Systems Programmer, University Hospital, Denver

$! ------------------ CUT HERE -----------------------
$ v='f$verify(f$trnlnm("SHARE_VERIFY"))'
$!
$! This archive created by VMS_SHARE Version 7.2-007  22-FEB-1990
$!   On  7-MAY-1992 16:20:43.49   By user DWING (DWING@UH01.Colorado.EDU)
$!
$! This VMS_SHARE Written by:
$!    Andy Harper, Kings College London UK
$!
$! Acknowledgements to:
$!    James Gray       - Original VMS_SHARE
$!    Michael Bednarek - Original Concept and implementation
$!
$! TO UNPACK THIS SHARE FILE, CONCATENATE ALL PARTS IN ORDER
$! AND EXECUTE AS A COMMAND PROCEDURE  (  @name  )
$!
$! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING:
$!       1. TSM_MESSAGE_PARSE.COM;53
$!
$set="set"
$set symbol/scope=(nolocal,noglobal)
$f=f$parse("SHARE_TEMP","SYS$SCRATCH:.TMP_"+f$getjpi("","PID"))
$e="write sys$error  ""%UNPACK"", "
$w="write sys$output ""%UNPACK"", "
$ if f$trnlnm("SHARE_LOG") then $ w = "!"
$ ve=f$getsyi("version")
$ if ve-f$extract(0,1,ve) .ges. "4.4" then $ goto START
$ e "-E-OLDVER, Must run at least VMS 4.4"
$ v=f$verify(v)
$ exit 44
$UNPACK: SUBROUTINE ! P1=filename, P2=checksum
$ if f$search(P1) .eqs. "" then $ goto file_absent
$ e "-W-EXISTS, File ''P1' exists. Skipped."
$ delete 'f'*
$ exit
$file_absent:
$ if f$parse(P1) .nes. "" then $ goto dirok
$ dn=f$parse(P1,,,"DIRECTORY")
$ w "-I-CREDIR, Creating directory ''dn'."
$ create/dir 'dn'
$ if $status then $ goto dirok
$ e "-E-CREDIRFAIL, Unable to create ''dn'. File skipped."
$ delete 'f'*
$ exit
$dirok:
$ w "-I-PROCESS, Processing file ''P1'."
$ if .not. f$verify() then $ define/user sys$output nl:
$ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT 'f'/OUT='P1'
PROCEDURE Unpacker ON_ERROR ENDON_ERROR;SET(FACILITY_NAME,"UNPACK");SET(
SUCCESS,OFF);SET(INFORMATIONAL,OFF);f:=GET_INFO(COMMAND_LINE,"file_name");b:=
CREATE_BUFFER(f,f);p:=SPAN(" ")@r&LINE_END;POSITION(BEGINNING_OF(b));
LOOP EXITIF SEARCH(p,FORWARD)=0;POSITION(r);ERASE(r);ENDLOOP;POSITION(
BEGINNING_OF(b));g:=0;LOOP EXITIF MARK(NONE)=END_OF(b);x:=ERASE_CHARACTER(1);
IF g=0 THEN IF x="X" THEN MOVE_VERTICAL(1);ENDIF;IF x="V" THEN APPEND_LINE;
MOVE_HORIZONTAL(-CURRENT_OFFSET);MOVE_VERTICAL(1);ENDIF;IF x="+" THEN g:=1;
ERASE_LINE;ENDIF;ELSE IF x="-" THEN IF INDEX(CURRENT_LINE,"+-+-+-+-+-+-+-+")=
1 THEN g:=0;ENDIF;ENDIF;ERASE_LINE;ENDIF;ENDLOOP;t:="0123456789ABCDEF";
POSITION(BEGINNING_OF(b));LOOP r:=SEARCH("`",FORWARD);EXITIF r=0;POSITION(r);
ERASE(r);x1:=INDEX(t,ERASE_CHARACTER(1))-1;x2:=INDEX(t,ERASE_CHARACTER(1))-1;
COPY_TEXT(ASCII(16*x1+x2));ENDLOOP;WRITE_FILE(b,GET_INFO(COMMAND_LINE,
"output_file"));ENDPROCEDURE;Unpacker;QUIT;
$ delete/nolog 'f'*
$ CHECKSUM 'P1'
$ IF CHECKSUM$CHECKSUM .eqs. P2 THEN $ EXIT
$ e "-E-CHKSMFAIL, Checksum of ''P1' failed."
$ ENDSUBROUTINE
$START:
$ create 'f'
X$!  TSM_MESSAGE_PARSE.COM - parse TSM output to get messages transmitted &
X$!        retransmitted, and messages received & duplicates received, for`20
X$!        all DECserver 300's.
X$!
X$!
X$!  Privileges required:
X$!     - OPER  (to startup TSM)
X$!     - READ access to TSM datafiles
X$!
X$!  Written for VMS V5.5, TSM V1.5, DECserver 300 V2.1
X$!
X$!!!!!
X$!
X$!  Written by Dan Wing, University Hospital, Denver, DWING@UH01.Colorado.ED
VU
X$!
X$!
X$!  REVERSE CHRONOLOGICAL MODIFICATION HISTORY
X$!
X$!  EDIT DATE  EDIT  BY   DESCRIPTION
X$!  ---------  ----  ---  ---------------------------------------
X$!   7-MAY-92  101   DGW  Removed hard-coded allowances for re-transmits
X$!                        and computed ratio.
X$!   6-MAY-92  100   DGW  Created.
X$!
X$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
X$
X$  ON WARNING THEN GOTO _ERROR
X$  ON CONTROL_Y THEN GOTO _ABORT
X$
X$  SET SYMBOL/SCOPE=(noGLOBAL)
X$
X$  MAXIMUM_DCL_VALUE = %X7FFFFFFF
X$
X$!
X$
X$  ALLOWABLE_RETRANSMIT   = 1000         ! ratio of re-Xmit allowed
X$  ALLOWABLE_DUP_RECEIVED = 1000         ! ratio of dup. rcvd allowed
X$
X$!
X$
X$  TEMPFILE = "SYS$LOGIN:TSM_MSG_PARSE_" + F$GETJPI(0,"PID") + ".TMP"
X$  OUTFILENAME = "SYS$LOGIN:TSM_MSG_PARSE.TXT"
X$
X$  TSM/OUTPUT='TEMPFILE'/TYPE=DS300 SHOW SERVER COUNT
X$
X$  OPEN/READ FILE 'TEMPFILE'
X$  OPEN/WRITE OUTFILE 'OUTFILENAME'
X$ `20
X$  WRITE OUTFILE "TSM_MESSAGE_PARSE report generated on ", F$TIME()
X$  WRITE OUTFILE "by user ", F$GETJPI(0,"USERNAME")
X$  WRITE OUTFILE ""
X$  WRITE OUTFILE ""
X$  WRITE OUTFILE "Allowed 1 retransmit per ", ALLOWABLE_RETRANSMIT, " messag
Ves transmitted."
X$  WRITE OUTFILE "Allowed 1 duplicate received per ", ALLOWABLE_DUP_RECEIVED
V, " messages received."
X$  WRITE OUTFILE ""
X$
X$_SERVER_LOOP:
X$  READ/END_OF_FILE=_EOF FILE RECORD
X$
X$  IF F$LOCATE("%TSM-I-CONNECT",RECORD) .LT. F$LENGTH(RECORD)
X$  THEN
X$    WRITE OUTFILE ""
X$    WRITE OUTFILE "Server: ", F$ELEMENT(4," ",RECORD)
X$    WRITE SYS$OUTPUT "Processing server: ", F$ELEMENT(4," ",RECORD)
X$  _COUNTER_LOOP:
X$    READ/END_OF_FILE=_PREMATURE_EOF FILE RECORD
X$    IF F$LOCATE("Messages Received:",RECORD) .LT. F$LENGTH(RECORD)
X$    THEN
X$      MSG_RECEIVED = F$INTEGER(F$EXTRACT(21,13,RECORD))
X$      MSG_DUP_RECEIVED = F$INTEGER(F$EXTRACT(63,13,RECORD))
X$      DUP_RECEIVED_RATIO = MSG_RECEIVED / MSG_DUP_RECEIVED
X$
X$      IF DUP_RECEIVED_RATIO .LT. ALLOWABLE_DUP_RECEIVED
X$      THEN
X$        DUP_RECEIVED_OKAY = "NOT OKAY"
X$      ELSE
X$        DUP_RECEIVED_OKAY = "Okay"
X$        IF DUP_RECEIVED_RATIO .EQ. MAXIMUM_DCL_VALUE THEN DUP_RECEIVED_RATI
VO = MSG_RECEIVED
X$      ENDIF
X$
X$      GOTO _COUNTER_LOOP
X$    ENDIF
X$
X$    IF F$LOCATE("Messages Transmitted:",RECORD) .LT. F$LENGTH(RECORD)
X$    THEN
X$      TRANSMIT = F$INTEGER(F$EXTRACT(21,13,RECORD))
X$      RE_TRANSMIT = F$INTEGER(F$EXTRACT(63,13,RECORD))
X$      RE_TRANSMIT_RATIO = TRANSMIT / RE_TRANSMIT
X$
X$      IF RE_TRANSMIT_RATIO .LT. ALLOWABLE_RETRANSMIT
X$      THEN
X$        RE_TRANSMIT_OKAY = "NOT OKAY"
X$      ELSE
X$        RE_TRANSMIT_OKAY = "Okay"
X$        IF RE_TRANSMIT_RATIO .EQ. MAXIMUM_DCL_VALUE THEN RE_TRANSMIT_RATIO
V = TRANSMIT
X$      ENDIF
X$
X$      WRITE OUTFILE F$FAO("  Transmit: !7UL  Retransmit: !7UL   (msgs per r
Ve-Xmit= !5UL)  !AS", TRANSMIT, RE_TRANSMIT, RE_TRANSMIT_RATIO, RE_TRANSMIT_O
VKAY)
X$      WRITE OUTFILE F$FAO("  Recieved: !7UL  Dup. Rc'vd: !7UL   (msgs per d
Vuplic=  !5UL)  !AS", MSG_RECEIVED, MSG_DUP_RECEIVED, DUP_RECEIVED_RATIO, DUP
V_RECEIVED_OKAY)
X$      GOTO _SERVER_LOOP
X$    ELSE
X$      GOTO _COUNTER_LOOP
X$    ENDIF
X$  ENDIF
X$ `20
X$  GOTO _SERVER_LOOP
X$
X$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
X$
X$_PREMATURE_EOF:
X$  WRITE SYS$OUTPUT "Premature EOF encountered by TSM_MESSAGE_PARSE.COM"
X$  GOTO _EXIT
X$
X$_EOF:
X$  WRITE OUTFILE ""
X$  WRITE OUTFILE "End of report."
X$  WRITE SYS$OUTPUT ""
X$  WRITE SYS$OUTPUT "Report is in ", OUTFILENAME
X$
X$_EXIT:
X$  IF F$TRNLNM("FILE") .NES. "" THEN CLOSE FILE
X$  IF F$TRNLNM("OUTFILE") .NES. "" THEN CLOSE OUTFILE
X$  IF F$SEARCH(TEMPFILE) .NES. "" THEN DELETE 'TEMPFILE';*
X$  EXIT
X$
X$_ERROR:
X$  WRITE SYS$OUTPUT "Unexpected error in TSM_MESSAGE_PARSE.COM"
X$  GOTO _EXIT
X$
X$_ABORT:
X$  WRITE SYS$OUTPUT "TSM_MESSAGE_PARSE aborted by user."
X$  GOTO _EXIT
$ CALL UNPACK TSM_MESSAGE_PARSE.COM;53 2033977681
$ v=f$verify(v)
$ EXIT

