The following program constructs an index of a listserver list using a
listserv monthly logfile as input. The program is written in DCL and
runs on VAX/VMS.
To use the program, set up a symbol of the form
$ index == "@this_program"
and then run it by entering
$ index <monthly logfile>
The output is put into a file sys$scratch:index.lis
and contains an alphabetic list of all the subjects discussed that
month, and a record of how many replies there were for each subject.
The program has been used to index over three years of GAELIC-L logs,
a task which would have been a lot more difficult without the program!
There's no support with this program - you need to fix bugs yourself!
You'll need to substitute the "GAELIC-L" string in the program with
the name of the list you're indexing.
Craig
-------- cut here -----
$ on control_y then goto abort
$ file = p1
$ ask_file:
$ if file .eqs. "" then inquire file "File? "
$ if file .eqs. "" then goto ask_file
$ search 'file "subject:"/out=sys$scratch:subj.tmp
$
$ open/read subj sys$scratch:subj.tmp
$ open/write compress sys$scratch:comp.tmp
$
$ read_loop:
$ read/end=close_subj subj line
$ line = f$edit(line,"TRIM")
$ if f$extract(0,1,line) .eqs. ">" then goto read_loop
$
$ remove_subj:
$ line = f$edit(f$extract(9,999,line),"TRIM")
$ if f$edit(f$extract(0,5,line),"UPCASE") .eqs. "SUBJ:" then -
line = f$edit(f$extract(5,999,line),"TRIM")
$ if f$edit(f$extract(0,8,line),"UPCASE") .eqs. "SUBJECT:" then -
line = f$edit(f$extract(8,999,line),"TRIM")
$ if f$extract(0,4,line) .eqs. "subj" then goto remove_subj
$
$ quote_loop:
$ quote_posn = f$locate("""",line)
$ if quote_posn .eq. f$length(line) then goto remove_re
$ line = f$extract(0,quote_posn,line)+ f$extract(quote_posn+1,999,line)
$ goto quote_loop
$
$ remove_re:
$ line = f$edit(line,"TRIM")
$ re_string = f$edit(f$extract(0,3,line),"UPCASE")
$ if (re_string .eqs. "RE:") .or. (re_string .eqs. "RE ") -
.or. (re_string .eqs. "RE.") -
then line = f$extract(3,9999,line)
$ if (re_string .eqs. "RE:") .or. (re_string .eqs. "RE ") -
.or. (re_string .eqs. "RE.") -
then goto remove_re
$
$ line = f$edit(line,"TRIM")
$ if f$extract(0,1,line) .eqs. ":" .or. -
f$extract(0,1,line) .eqs. "*"
$ then
$ line = f$extract(1,999,line)
$ goto remove_re
$ endif
$
$ line = f$edit(line,"TRIM")
$ line = f$edit(f$extract(0,1,line),"UPCASE")+f$extract(1,9999,line)
$ if f$locate("File: GAELIC-L LOG",line) .eq. f$length(line) then -
write compress line
$ goto read_loop
$
$ close_subj:
$ close compress
$ close subj
$
$ sort sys$scratch:comp.tmp sys$scratch:sort.lis
$ count = 0
$ previous = ""
$ reply_string = ""
$ open/read subj sys$scratch:sort.lis
$ open/write outfile sys$scratch:index.lis
$
$ read_loop:
$ read/end_of_file=finished subj line
$ if f$edit(line,"UPCASE") .eqs. f$edit(previous,"UPCASE")
$ then
$ count = count + 1
$ else
$ reply_string = " (no replies) "
$ if count .eq. 1 then reply_string = " [ 1 reply ]"
$ if count .gt. 1 then reply_string = " [ ''count' replies ]"
$ if previous .nes. "" then previous = f$extract(0,65,previous)
$ pad = 80 - f$length(previous) - f$length(reply_string)
$ reply_string = f$fao("!(#AS)",pad," ") + reply_string
$ outline = previous + reply_string
$ if previous .nes. "" then write outfile outline
$ count = 0
$ previous = line
$ endif
$ goto read_loop
$
$ finished:
$ reply_string = " (no replies) "
$ if count .eq. 1 then reply_string = " [ 1 reply ]"
$ if count .gt. 1 then reply_string = " [ ''count' replies ]"
$ line = f$extract(0,65,line)
$ pad = 80 - f$length(line) - f$length(reply_string)
$ reply_string = f$fao("!(#AS)",pad," ") + reply_string
$ write outfile line + reply_string
$ close outfile
$ close subj
$ delete sys$scratch:comp.tmp;*
$ delete sys$scratch:subj.tmp;*
$ delete sys$scratch:sort.lis;*
$ exit
$
$ abort:
$ write sys$output "Program aborted"
$ if f$trnlnm("subj") .nes. "" then close subj
$ if f$trnlnm("comp") .nes. "" then close comp
$ if f$trnlnm("outfile") .nes. "" then close outfile
|