From:	MERC::"uunet!CRVAX.SRI.COM!RELAY-INFO-VAX" 14-JUN-1992 19:14:42.80
To:	info-vax@kl.sri.com
CC:	
Subj:	RE: Archiving mail files

With all this talk about archiving MAIL via extracting, I thought someone might 
be interested in some DCL toys I put together a while back.  Nothing fancy, 
except that it puts a table of contents (i.e. the mail directory) at the front 
of the extracted file.  And there's a "driver" DCL file so that you can 
automate your email dumps via batch.  First, MAIL-DRIVER, then MAIL-DUMP.

-------------------------------<Cut Here>--------------------------------
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ !									!
$ !   This is an example of how to create a self-perpetuating batch job	!
$ ! for reading, printing and deleteing mail messages.  The program	!
$ ! that actually performs the dirty work is MAIL-DUMP.COM.		!
$ !									!
$ !   Calls to MAIL-DUMP are of the general form:			!
$ !									!
$ !		MAIL-DUMP folder from extension				!
$ !									!
$ !   In the following, for example, four files with today's date will	!
$ ! be created.  They will all draw on the folder NEWMAIL by default,	!
$ ! will look for "ROOTS", "MATTIOLI" or "ATW1H" in the "From:" line,	!
$ ! and GENEALOGY, HANDICAP, MEDICAL and MISC will be used as file ex-	!
$ ! tensions.								!
$ !									!
$ !   The final line in this file indicates that the batch file resub-	!
$ ! mits itself every one days.						!
$ !									!
$ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$	SET NOON
$	SET DEFAULT [CADS2.COLE.MAIL]
$	@MAIL-DUMP AMIGA	""		AMIGA
$!	@MAIL-DUMP INFO-VAX	""		INFO-VAX
$!	@MAIL-DUMP ""		ROOTS		GENEALOGY
$!	@MAIL-DUMP ""		MATTIOLI	HANDICAP
$!	@MAIL-DUMP "" 		ATW1H		MEDICAL
$!	@MAIL-DUMP ""		""		MISC
$	IF F$CVTIME("TODAY",,"WEEKDAY").EQS."Saturday" THEN GOTO THREE
$	IF F$CVTIME("TODAY",,"WEEKDAY").EQS."Sunday"   THEN GOTO TWO
$ ONE:
$	SUBMIT MAIL-DRIVER/AFTER="TODAY+1-01:00"
$	EXIT
$ TWO:
$	SUBMIT MAIL-DRIVER/AFTER="TODAY+2-01:00"
$	EXIT
$ THREE:
$	SUBMIT MAIL-DRIVER/AFTER="TODAY+3-01:00"
$	EXIT
-------------------------------------------------------------------------


-------------------------------<Cut Here>--------------------------------
$!      *** MAIL-DUMP ***       Written by Kevin Cole at Gallaudet U.  09/89
$!				Slightly revised		       08/90
$!
$!   This accepts a folder name, a "From:" spec and a file extension, and dumps 
$! the selected messages AND a directory of the messages to a file named 
$! YYMMDD.extension, where YYMMDD is today's date (YY/MM/DD) and the extension 
$! is either what you specified or the "From:" spec you chose.
$!
$! NOTE:  Then, it blithely assumes all is well, deletes the dumped messages,
$!        compresses the mail and deletes any MAIL.OLD that it can find.  This
$!        MAY not be a feature you would appreciate.  ;-)  (No warrentees, no
$!        refunds, etc, etc.)
$!
$!  It could probably use a lot of improvement...  I just claim credit for the
$!  idea, not necessarily the implementation.  Please send improvements my way.
$!
$!                                     Kevin Cole    (CADS_COLE@GALLUA.BITNET)
$!-----------------------------------------------------------------------------
$! To use, type:
$!
$!      @MAIL-DUMP [folder] [From spec] [extension]
$!
$!  If all three parameters are ommitted, you'll get your entire MAIL folder 
$!  and the filename will be yymmdd.TXT.  If only the extension is ommitted, 
$!  you'll get a filename of yymmdd.fromspec.  If the fromspec is ommitted,
$!  you get yymmdd.foldername.
$!
$!  See MAIL-DRIVER.COM for an example of how to set this up as a batch job...
$!-----------------------------------------------------------------------------
$!
$!  Build me some commands and a filename with today's date in it.
$!
$         SELECT = "SEL/NEW"
$         EXTENS = "TXT"
$         IF P1 .NES. ""
$	  THEN 
$	    SELECT = "SEL "+P1
$	    EXTENS = P1
$	  ELSE
$	    P1 = "NEWMAIL"
$	  ENDIF
$         IF P2 .NES. ""
$	  THEN
$	    SELECT = "SEL/FROM="+P2+" "+P1
$	    EXTENS = P2
$	  ENDIF
$	  IF P3 .NES. "" THEN EXTENS = P3
$         FID    = F$CVTIME() - "19" - "-" - "-"
$         FID    = F$EXTRACT(0,6,FID) + "." + EXTENS
$         DUMPTO = "EXTRACT/ALL/APPEND " + FID
$!
$!  Write the directory out to the file.
$!
$         OPEN/WRITE    KLUDGE CANNED.RESPONSES
$         WRITE/SYMBOL  KLUDGE SELECT
$         WRITE         KLUDGE "DIR"
$         WRITE         KLUDGE "EXIT"
$         CLOSE         KLUDGE
$         DEFINE/USER SYS$INPUT   CANNED.RESPONSES
$         DEFINE/USER SYS$OUTPUT  'FID'
$         MAIL
$         DELETE CANNED.RESPONSES;*
$!
$!  Append the messages to the directory/table of contents and wipe 'em.
$!
$         OPEN/WRITE    KLUDGE CANNED.RESPONSES
$         WRITE/SYMBOL  KLUDGE SELECT
$         WRITE         KLUDGE DUMPTO
$         IF P1 .EQS. "" THEN GOTO SAVE
$         WRITE         KLUDGE "DEL/ALL"
$         WRITE         KLUDGE "COMPRESS"
$ SAVE:
$         WRITE         KLUDGE "EXIT"
$         CLOSE         KLUDGE
$         DEFINE/USER SYS$INPUT CANNED.RESPONSES
$         MAIL
$         DELETE CANNED.RESPONSES;*
$!
$!  Scrap the uncompressed mail file (DELETE MAIL.OLD)
$!  Get rid of incomplete compression (MAIL*.TMP) files as well.
$!
$	  SET NOON
$         DELETE/LOG/NOCONF [...]MAIL.OLD;*
$	  SET PROTECT=(O:RWED) [...]MAIL*.TMP;*
$	  DELETE/LOG/NOCONF [...]MAIL*.TMP;*
$!
$!  Print and delete the extracted messages.
$!
$!	  IMPRINT/DUPLEX/PORT/TWO/DELETE/PRIO=97 'FID'
$ PRINT/DELETE/PRIO=97/QUEUE=ANSI_L2EGB1/PARAM=(SIDES=2,NUMBER_UP=2, -
  PAGE_ORIENTATION=P,INPUT_TRAY=BOTTOM,OUTPUT_TRAY=TOP) 'FID'
----------------------------------------------------------------------------

-- 

 ========== U.S. Mail =============================== E-Mail =================
 Kevin Cole      <Flatline>           |  Bitnet: CADS_COLE@GALLUA.BITNET
 Gallaudet Research Institute  (GRI)  |  Internet: KJCOLE@GALLUX.GALLAUDET.EDU
 Washington, D.C.  20002-3625         |  UUCP: ...!psuvax!gallua.bitnet!kjcole
 (202) 651-5575  x4592                |  The WELL:   kjcole

