From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX"  5-APR-1991 20:19:10.09
To:	ARISIA::EVERHART
CC:	
Subj:	RE: Mail sorting...

From:	RELAY-INFO-VAX@CRVAX.SRI.COM@SMTP@CRDGW2
To:	Everhart@Arisia@MRGATE

Received:  by crdgw1.ge.com (5.57/GE 1.94)
	 id AA11443; Fri, 5 Apr 91 19:34:31 EST
Received: From UKCC.UKY.EDU by CRVAX.SRI.COM with TCP; Thu,  4 APR 91 15:48:45 PST
Received: from ukcc.uky.edu by UKCC.uky.edu (IBM VM SMTP V2R1)
   with BSMTP id 5637; Thu, 04 Apr 91 18:48:50 EST
Received: from UKCC by ukcc.uky.edu (Mailer R2.07) with BSMTP id 0481; Thu, 04
 Apr 91 18:48:50 EST
Received: from WKUVX1.BITNET by ukcc.uky.edu (Mailer R2.07) with BSMTP id 0480;
 Thu, 04 Apr 91 18:48:49 EST
Received: by WKUVX1.BITNET (MX V2.2-2) id 32592; Thu, 04 Apr 1991 17:46:45 CST
Date: Thu, 04 Apr 1991 17:46:45 CST
From: "Baron L. Chandler" <bchandle@WKUVX1.BITNET>
To: INFO-VAX@SRI.COM
Message-Id: <00946A2D.77303E20.32592@WKUVX1.BITNET>
Subject: RE: Mail sorting...

Well, this is what I use to get the job done... From what I understand, you can
also use DELIVER to do the same thing...

Here is the SHARE...


$! ------------------ CUT HERE -----------------------
$ v='f$verify(f$trnlnm("SHARE_VERIFY"))'
$!
$! This archive created by VMS_SHARE Version 7.2-007  22-FEB-1990
$!   On  4-APR-1991 17:40:19.93   By user BCHANDLE
$!
$! 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. MAILBATCH.COM;8
$!
$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$! MAIL-SORTING DAEMON
X$!`20
X$!`20
X$! This sorts all of your new mail files according to
X$! who owns the mail...
X$!
X$! use by saying
X$! SUBMIT MAILBATCH
X$!
X$ define YOUR$MAILDIR "WKU$USER:`5BBCHANDLE.MAIL`5D"
X$ set proc/name="BCs MAIL DAEMON"
X$ set proc/prio=3
X$ startover:
X$ OPEN/READ SORTLIST YOUR$MAILDIR:SORTLIST.DAT
X$ OPEN/WRITE SORTCOMMAND YOUR$MAILDIR:SORTCMD.DAT
X$ write SORTCOMMAND "SEL MAIL"
X$ READLOOP:
X$ READ/END=EXITOUT SORTLIST P2
X$ READ SORTLIST P3
X$ WRITE SORTCOMMAND "SEL/FROM=''P2'"
X$ if P3 .EQS. "WASTEBASKET" then goto skipfile
X$ WRITE SORTCOMMAND "FILE/ALL/NOCONFIRM ''P3'"
X$ GOTO SKIPDELETE
X$ SKIPFILE:
X$ WRITE SORTCOMMAND "DEL/ALL"
X$ SKIPDELETE:
X$ GOTO READLOOP
X$ EXITOUT:`20
X$ WRITE SORTCOMMAND "PURGE/RECLAIM"
X$ write sortcommand "COMPRESS"
X$ close sortcommand
X$ close sortlist
X$ define/user sys$input YOUR$MAILDIR:sortcmd.dat
X$ define/user sys$command YOUR$MAILDIR:sortcmd.dat
X$ mail
X$ delete YOUR$MAILDIR:SORTCMD.DAT;
X$ delete YOUR$MAILDIR:MAIL.OLD;
X$ submit/q=slow$batch/AFTER=TOMORROW YOUR$MAILDIR:MAILBATCH.COM/print=tccw-
X  /nolog
$ CALL UNPACK MAILBATCH.COM;8 119245447
$ v=f$verify(v)
$ EXIT


This also uses a data file called SORTLIST.DAT... It has the simple format

USERNAME
FOLDERNAME

ie..

INFO-VAX
VAX_Stuff

It is designed to submit itself over and over again into a SLOW BATCH queue...
You should also change its process name and re-define YOUR$MAIL$DIR before
using it.  It operates every 24 hours... You can have it do this more often...
I find that you can just say SET ENTRY/RELEASE to submit it if you get
over-crowded in the MAIL folder...

Hope it works okay for you,

Baron L. Chandler


||||||||||||||||||||||||  May  ALLAH  blow  sand  in  |||||||||||||||||||||||||

  % % % % % ##################    ]              Baron L. Chandler
   % % % % %                      [         Western Kentucky University
  % % % % % ##################    ]         Computer Science Department
   % % % % %                      [
  % % % % % ##################    ]       BITNET:  BCHANDLE@WKUVX1.BITNET
                                  [         INTERNET:  chandler@wku.edu
  ############################    ]    _____________________________________

|||||||||||||||||||||  Saddam's Hussein's Preparation - H  ||||||||||||||||||||



||||||||||||||||||||||||  May  ALLAH  blow  sand  in  |||||||||||||||||||||||||

  % % % % % ##################    ]              Baron L. Chandler
   % % % % %                      [         Western Kentucky University
  % % % % % ##################    ]         Computer Science Department
   % % % % %                      [
  % % % % % ##################    ]       BITNET:  BCHANDLE@WKUVX1.BITNET
                                  [         INTERNET:  chandler@wku.edu
  ############################    ]    _____________________________________

|||||||||||||||||||||  Saddam's Hussein's Preparation - H  ||||||||||||||||||||

