From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CUNYVM.CUNY.EDU::POSTMAST%YMIR.BITNET"  1-JUL-1989 04:27
To:	MRGATE::"ARISIA::EVERHART"
Subj:	Summarizing MAIL.LOG

Resent-From: @CUNYVM.CUNY.EDU:postmast@YMIR.BITNET
Received: from YMIR.BITNET by CUNYVM.CUNY.EDU (IBM VM SMTP R1.1) with BSMTP id 9359; Sat, 01 Jul 89 04:08:04 EDT
Resent-Message-Id: <8F0A18A8E39FE02E02@YMIR.BITNET>
Message-Id: <8F0CE4F3DC5FE02D59@YMIR.BITNET>
Received: from CUNYVM.BITNET by YMIR.BITNET; Fri, 30 Jun 89 19:06 PDT
Received: from CUNYVM by CUNYVM.BITNET (Mailer R2.03B) with BSMTP id 4697; Fri,
 30 Jun 89 18:18:06 EDT
Received: from RELAY.CS.NET by CUNYVM.CUNY.EDU (IBM VM SMTP R1.1) with TCP;
 Fri, 30 Jun 89 18:17:53 EDT
Received: from relay2.cs.net by RELAY.CS.NET id aa06880; 30 Jun 89 15:32 EDT
Received: from merrimack.edu by RELAY.CS.NET id aa14730; 30 Jun 89 15:25 EDT
Resent-Date: Fri, 30 Jun 89 19:08 PDT
Date: Fri, 30 Jun 89 11:10 EST
From: "Rand P. Hall" <RAND%merrimack.edu%RELAY.CS.NET@CUNYVM.CUNY.EDU>
Subject: Summarizing MAIL.LOG
Resent-To: INFO-PMDF-LIST2@YMIR.BITNET
To: info-pmdf%ymir.bitnet@RELAY.CS.NET
Errors-To: postmast@YMIR.BITNET
X-Vms-To: IN%"info-pmdf@ymir.BITNET"

I haven't seen anyone do anything with PMDF V3's `accounting' feature,
MAIL.LOG.

Consequently, one of our people threw together something to condense it.

Nothing fancy, but it does give you a feel for your traffic.

rand

pmdf_summary.1_of_2

$! ................... Cut between dotted lines and save. ...................
$!...........................................................................
$! VAX/VMS archive file created by VMS_SHARE V06.10 7-FEB-1989.
$!
$! VMS_SHARE was written by James Gray (Gray:OSBUSouth@Xerox.COM) from
$! VMS_SHAR by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au).
$!
$! To unpack, simply save, concatinate all parts into one file and
$! execute (@) that file.
$!
$! This archive was created by user RAND
$! on 30-JUN-1989 10:59:37.56.
$!
$! ATTENTION: To keep each article below 31 blocks (15872 bytes), this
$!            program has been transmitted in 2 parts.  You should
$!            concatenate ALL parts to ONE file and execute (@) that file.
$!
$! It contains the following 6 files:
$!        AAAREADME.1ST
$!        HEADER.TXT
$!        MM.COM
$!        PMDF_SORT.COM
$!        PMDF_SUM.COM
$!        PMDF_SUM.PAS
$!
$!============================================================================
$ SET SYMBOL/SCOPE=( NOLOCAL, NOGLOBAL )
$ VERSION = F$GETSYI( "VERSION" )
$ IF VERSION .GES "V4.4" THEN GOTO VERSION_OK
$ WRITE SYS$OUTPUT "You are running VMS ''VERSION'; ", -
    "VMS_SHARE V06.10 7-FEB-1989 requires VMS V4.4 or higher."
$ EXIT 44 ! SS$_ABORT
$VERSION_OK:
$ GOTO START
$!
$UNPACK_FILE:
$ WRITE SYS$OUTPUT "Creating ''FILE_IS'"
$ DEFINE/USER_MODE SYS$OUTPUT NL:
$ EDIT/TPU/COMMAND=SYS$INPUT/NODISPLAY/OUTPUT='FILE_IS'/NOSECTION -
    VMS_SHARE_DUMMY.DUMMY
b_part := CREATE_BUFFER( "{Part}", GET_INFO( COMMAND_LINE, "file_name" ) )
; s_file_spec := GET_INFO( COMMAND_LINE, "output_file" ); SET( OUTPUT_FILE
, b_part, s_file_spec ); b_errors := CREATE_BUFFER( "{Errors}" ); i_errors
:= 0; pat_beg_1 := ANCHOR & "-+-+-+ Beginning"; pat_beg_2 := LINE_BEGIN
& "+-+-+-+ Beginning"; pat_end := ANCHOR & "+-+-+-+-+ End"; POSITION
( BEGINNING_OF( b_part ) ); LOOP EXITIF SEARCH( SPAN( ' ' )@r_trail
& LINE_END, FORWARD) = 0; POSITION( r_trail ); ERASE( r_trail ); ENDLOOP
; POSITION( BEGINNING_OF( b_part ) ); i_append_line := 0; LOOP EXITIF MARK
( NONE ) = END_OF( b_part ); s_x := ERASE_CHARACTER( 1 )
; IF s_x = '+' THEN r_skip := SEARCH( pat_beg_1, FORWARD, EXACT ); IF r_skip
<> 0 THEN s_x := ''; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ERASE_LINE; ENDIF
; ENDIF; IF s_x = '-' THEN r_skip := SEARCH( pat_end, FORWARD, EXACT )
; IF r_skip <> 0 THEN s_x := ''; MOVE_HORIZONTAL( -CURRENT_OFFSET ); m_skip
:= MARK( NONE ); r_skip := SEARCH( pat_beg_2, FORWARD, EXACT ); IF r_skip
<> 0 THEN POSITION( END_OF( r_skip ) ); MOVE_HORIZONTAL( -CURRENT_OFFSET )
; MOVE_VERTICAL( 1 ); MOVE_HORIZONTAL( -1 ); ELSE POSITION( END_OF( b_part )
); ENDIF; ERASE( CREATE_RANGE( m_skip, MARK( NONE ), NONE ) ); ENDIF; ENDIF
; IF s_x = 'V' THEN s_x := ''; IF i_append_line <> 0 THEN APPEND_LINE
; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ENDIF; i_append_line := 1
; MOVE_VERTICAL( 1 ); ENDIF; IF s_x = 'X' THEN s_x := ''; IF i_append_line
<> 0 THEN APPEND_LINE; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ENDIF
; i_append_line := 0; MOVE_VERTICAL( 1 ); ENDIF; IF s_x <> '' THEN i_errors
:= i_errors + 1; s_text := CURRENT_LINE; POSITION( b_errors ); COPY_TEXT
( "The following line could not be unpacked properly:" ); SPLIT_LINE
; COPY_TEXT( s_x ); COPY_TEXT( s_text ); POSITION( b_part ); MOVE_VERTICAL
( 1 ); ENDIF; ENDLOOP; POSITION( BEGINNING_OF( b_part ) ); LOOP r_x := SEARCH
( "`", FORWARD, EXACT ); EXITIF r_x = 0; POSITION( r_x ); ERASE_CHARACTER( 1
); COPY_TEXT( ASCII( INT( ERASE_CHARACTER( 3 ) ) ) ); ENDLOOP
; IF i_errors = 0 THEN SET( NO_WRITE, b_errors, ON ); ELSE POSITION
( BEGINNING_OF( b_errors ) ); COPY_TEXT( FAO
( "The following !UL errors were detected while unpacking !AS", i_errors
, s_file_spec ) ); SPLIT_LINE; SET( OUTPUT_FILE, b_errors, "SYS$COMMAND" )
; ENDIF; EXIT;
$ DELETE VMS_SHARE_DUMMY.DUMMY;*
$ CHECKSUM 'FILE_IS
$ WRITE SYS$OUTPUT " CHECKSUM ", -
  F$ELEMENT( CHECKSUM_IS .EQ. CHECKSUM$CHECKSUM, ",", "failed!!,passed." )
$ RETURN
$!
$START:
$ FILE_IS = "AAAREADME.1ST"
$ CHECKSUM_IS = 302197655
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X1 PMDF_SUM
X
X    PMDF_SUM takes the log file created by pmdf (MAIL.LOG), totals the number
V    and size of messages for each user, and then sorts the results. This can
X be
X    used for billing, archive or informational purposes.
X
X    Parameters
X
X        Month    Sort    Input_file    Output_file
X
X    Format:
X
X`009@PMDF_SUM month sort input_file output_file
X
X
X2 Month
X
X     Select the month you want totaled. The default is TOT (all months
X     totaled). The following options are also available:
X
X     JAN        APR        JUL         OCT
X     FEB        MAY        AUG         NOV
X     MAR        JUN        SEP         DEC
X
X2 Sort
X
X     Select the key you want the results sorted by. The default is NAME (the
X     name of the person sending or receiving the message). The following`032
X     options are also available:
X
X     In_count             Insize            Inavg
X     Out_count            Outsize           Outavg
X
X
X2 Input_file
X
X     Select the file to be used for input. MAIL.LOG is the default.
X
X2 Output_file
X
X     Select the file to be used for output. MAIL.TOT is the default.
X
X
X1 PMDF_SORT
X
V    Sort the output file after it has been summed by PMDF_SUM.  You cannot so
Xrt
X    the datafile until you have summed it.  PMDF_SUM calls on PMDF_SORT for
X    output.
X  `032
X    Parameters
X
X        Sort    Input_output
X
X    Format:
X
X`009@PMDF_SUM sort input_output
X
X2 Sort
X
X     Select the key you want the results sorted by. The default is NAME (the
X     name of the person sending or receiving the message). The following`032
X     options are also available:
X
X     In_count             Insize            Inavg
X     Out_count            Outsize           Outavg
X
X
X2 Input_output
X
X     Select the input/output file to be sorted. The input file and the output
X     file for PMDF_SORT are one in the same. Therefore, if you sort
X     MAIL.TOT;17, the output file will be MAIL.TOT;18.
X
X1 Examples
X
X    $ @pmdf_sum  ! Total all messages, sort the results by name.
X
V    Name              InCount    Insize     InAve  OutCount   OutSize    OutA
Xve
V    AIN14924               42       300       7.1        36       148       4
X.1
V    AIN1496                 2        13       6.5         0         0       0
X.0
V    AIN1496E                8        20       2.5        24        24       1
X.0
V    AIN1497D               16        18       1.1        12        29       2
X.4
V    AIN1498B                2         2       1.0         0         0       0
X.0
V    AIN14998                0         0       0.0         2         2       1
X.0
V    AIN149A5                4         4       1.0         0         0       0
X.0
V    HOGANP%MCEE2           18       262      14.6         0         0       0
X.0
V    JOHN                   16        29       1.8        10        14       1
X.4
V    MASCOLO                34       145       4.3        12        21       1
X.8
V    NCS13B16                2         2       1.0         0         0       0
X.0
V    PA_GREG                 4         4       1.0         4         4       1
X.0
V    PA_MARYANN              2        25      12.5         0         0       0
X.0
V    PDUCHARME               4        10       2.5         0         0       0
X.0
V    POSTMASTER              0         0       0.0        22        82       3
X.7
V    RAND                 2620      9966       3.8        74       443       6
X.0
V    REYESEM%MCEE2          19       263      13.8         0         0       0
X.0
V    SIFFER%MCEE2           19       263      13.8         0         0       0
X.0
V    SIFFERLEN               2         2       1.0         0         0       0
X.0
V    WRIDE                   2         3       1.5         0         0       0
X.0
X
X
X    $ @pmdf_sort inaverage !Sort the totaled database by average inbound size
X
V    Name              InCount    Insize     InAve  OutCount   OutSize    OutA
Xve
V    AIN14998                0         0       0.0         2         2       1
X.0
V    POSTMASTER              0         0       0.0        22        82       3
X.7
V    AIN149A5                4         4       1.0         0         0       0
X.0
V    AIN1498B                2         2       1.0         0         0       0
X.0
V    SIFFERLEN               2         2       1.0         0         0       0
X.0
V    PA_GREG                 4         4       1.0         4         4       1
X.0
V    NCS13B16                2         2       1.0         0         0       0
X.0
V    AIN1497D               16        18       1.1        12        29       2
X.4
V    WRIDE                   2         3       1.5         0         0       0
X.0
V    JOHN                   16        29       1.8        10        14       1
X.4
V    PDUCHARME               4        10       2.5         0         0       0
X.0
V    AIN1496E                8        20       2.5        24        24       1
X.0
V    RAND                 2620      9966       3.8        74       443       6
X.0
V    MASCOLO                34       145       4.3        12        21       1
X.8
V    AIN1496                 2        13       6.5         0         0       0
X.0
V    AIN14924               42       300       7.1        36       148       4
X.1
V    PA_MARYANN              2        25      12.5         0         0       0
X.0
V    REYESEM%MCEE2          19       263      13.8         0         0       0
X.0
V    SIFFER%MCEE2           19       263      13.8         0         0       0
X.0
V    HOGANP%MCEE2           18       262      14.6         0         0       0
X.0
X
X
X
V    $ @pmdf_sum DEC in_count !Sum messages dated 'December', sort by # inboun
Xd`032
V    Name              InCount    Insize     InAve  OutCount   OutSize    OutA
Xve
V    POSTMASTER              0         0       0.0         4        28       7
X.0
V    PA_MARYANN              2        25      12.5         0         0       0
X.0
V    AIN1496                 2        13       6.5         0         0       0
X.0
V    AIN149A5                2         2       1.0         0         0       0
X.0
V    JOHN                    4        13       3.3         4         8       2
X.0
V    AIN1496E                4        16       4.0        12        12       1
X.0
V    REYESEM%MCEE2           9       115      12.8         0         0       0
X.0
V    HOGANP%MCEE2            9       115      12.8         0         0       0
X.0
V    SIFFER%MCEE2            9       115      12.8         0         0       0
X.0
V    AIN14924               16       188      11.8        16        96       6
X.0
V    MASCOLO                22        64       2.9         6        14       2
X.3
V    RAND                 1106      5377       4.9        29       243       8
X.4
X
X1 Installation
X
VFor system managers (who this whole program is aimed at), there is very littl
Xe
Vmodification needed to customize this. In the pascal source code, MERRIMACK.E
XDU
Xis hardcoded in as the name of the institution. Replace your institution name
Xand recompile. There are no logical necessary for this program.
$ GOSUB UNPACK_FILE

$ FILE_IS = "HEADER.TXT"
$ CHECKSUM_IS = 996111945
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
XName              InCount    Insize     InAve  OutCount   OutSize    OutAve
X
$ GOSUB UNPACK_FILE

$ FILE_IS = "MM.COM"
$ CHECKSUM_IS = 1815879666
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X$ set noon
X$ set noverify
X$ Months = "DECJANFEBMARAPRMAYJUNJULAUGSEPOCTNOV"
X$ date_time := 'f$time()`009`009!Get date to find month
X$ imonth := 'f$extract(5,2,f$cvtim(date_time))
X$ month = f$extract((imonth-1)*3,3,months)
X$ sh sym month
X$ here="''f$logical("sys$disk")'"+"''f$directory()'"
X$ set def pmdf$root:[sum]
X$ @pmdf$root:[sum]pmdf_sum -
X`009'month name pmdf$root:[log]mail.log  -           `032
X`009pmdf$root:[sum]mail.tot
X$ copy pmdf$root:[sum]header.txt pmdf$root:[sum]temp.txt
X$ append pmdf$root:[sum]mail.tot pmdf$root:[sum]temp.txt
X$ mail pmdf$root:[sum]temp.txt rand/subj="PMDF sums for last month"
X$ delete pmdf$root:[sum]temp.txt;*
X$ set def 'here'
$ GOSUB UNPACK_FILE

$ FILE_IS = "PMDF_SORT.COM"
$ CHECKSUM_IS = 1158029417
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X$! By now, the data has been put into an output file PMDF$SUM_INPUT
X$! The input file and the output file are one in the same, so when you type
V$! PMDF_SORT fred.log, the file fred.log will be superseded by a new, sorted`
X032
V$! version of fred.log. The sort just uses the sort procedure in DCL, and thi
Xs
V$! just specifies on what columns to sort on. This also types out the results
X`032
X$! with a header.
X$!
X$!
X$ The_sort_key := 'P1
X$ If The_sort_key .eqs. ""
X$    Then
X$    The_sort_key = "Name"
X$ Endif
X$
X$! infile = f$trnlnm("pmdf$sum_input")
X$! If infile .eqs. ""
X$!    Then
X$!    assign 'P2 pmdf$sum_input
X$! Endif
X$
X$! infile = f$trnlnm("pmdf$sum_input")
X$! If infile .eqs. ""
X$!    Then
X$!    assign Mail.tot pmdf$sum_input
X$! Endif
X$
X$ outfile = f$trnlnm("pmdf$sum_output")
X$ If outfile .eqs. ""
X$    Then
X$    assign 'P2 pmdf$sum_output
X$ Endif
X$
X$ outfile = f$trnlnm("pmdf$sum_output")
X$ If outfile .eqs. ""
X$    Then
X$    assign Mail.tot pmdf$sum_output
X$ Endif
X$ the_sort_key = f$edit(the_sort_key,"UPCASE")
X$ SORT_LIST = "IN_COUNT/OUT_COUNT/INSIZE/OUTSIZE/INAVERAGE/OUTAVERAGE/NAME"
X$ POSITION = F$LOCATE(the_sort_key,SORT_LIST)
X$ IF POSITION .EQS. 59 THEN GOTO BADsort
X$ the_sort_key = f$extract(position,4,sort_list)
X$ If the_sort_key .eqs. "IN_C"`032
X$    THEN
X$    Sort /key = (position:16,size:10) pmdf$sum_output pmdf$sum_output
X$    GOTO FINISH
X$ ENDIF
X$
X$ If the_sort_key .eqs. "OUT_"
X$    THEN
X$    Sort /key = (position:46,size:10) pmdf$sum_output pmdf$sum_output
X$    GOTO FINISH
X$ ENDIF
X$
X$ If the_sort_key .eqs. "INSI"`032
X$    THEN
X$    Sort /key = (position:26,size:10) pmdf$sum_output pmdf$sum_output
X$    GOTO FINISH
X$ ENDIF
X$
X$ If the_sort_key .eqs. "OUTS"`032
X$    THEN
X$    Sort /key = (position:56,size:10) pmdf$sum_output pmdf$sum_output
X$    GOTO FINISH
X$ ENDIF
X$
X$ If the_sort_key .eqs. "INAV"`032
X$    THEN
X$    Sort /key = (position:36,size:10) pmdf$sum_output pmdf$sum_output
X$    GOTO FINISH
X$ ENDIF
X$
X$ If the_sort_key .eqs. "OUTA"`032
X$    THEN
X$    Sort /key = (position:66,size:10) pmdf$sum_output pmdf$sum_output
X$    GOTO FINISH
X$ ENDIF
X$
X$ If the_sort_key .eqs. "NAME"`032
X$    THEN
X$    Sort /key = (position:1,size:15) pmdf$sum_output pmdf$sum_output
X$    GOTO FINISH
X$ ENDIF
X$
X$ Exit
X$ BADSORT:
X$ TYPE SYS$INPUT
X
XSorry, but that is not a valid choice. The valid choices are
X`009
X`009`009IN_C         INSIZE      INAVERAGE       NAME
X`009`009OUT_C        OUTSIZE     OUTAVERAGE
X
X$ EXIT
X$ Finish:
X$ write sys$output -
X"Name              InCount    Insize     InAve  OutCount   OutSize    OutAve"
V$!234567891123456789212345678931234567894123456789512345678961234567897123456
X789
X$ type pmdf$sum_output
X$ Exit
$ GOSUB UNPACK_FILE

$ FILE_IS = "PMDF_SUM.COM"
$ GOTO PART2
-+-+-+-+-+ End of part 1 +-+-+-+-+-
