From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CUNYVM.CUNY.EDU::POSTMAST%YMIR.BITNET" 29-JUL-1989 06:04
To:	MRGATE::"ARISIA::EVERHART"
Subj:	RE: Interfacing PMDF/DELIVER and VAX NOTES

Resent-From: @CUNYVM.CUNY.EDU:postmast@YMIR.BITNET
Received: from YMIR.BITNET by CUNYVM.CUNY.EDU (IBM VM SMTP R1.1) with BSMTP id 9779; Sat, 29 Jul 89 05:38:59 EDT
Resent-Message-Id: <78E68C66EB9FC030A5@YMIR.BITNET>
Message-Id: <78E8F3DB129FC03324@YMIR.BITNET>
Resent-Date: Fri, 28 Jul 89 23:20 PDT
Date: Fri, 28 Jul 89 23:19 PDT
From: Ned Freed <NED%HMCVAX.BITNET@CUNYVM.CUNY.EDU>
Subject: RE: Interfacing PMDF/DELIVER and VAX NOTES
Resent-To: INFO-PMDF-LIST2@YMIR.BITNET
To: info-pmdf@YMIR.BITNET
Errors-To: postmast@YMIR.BITNET
X-Envelope-To: Everhart%Arisia.decnet@crd.ge.com, STODOLA@curie.rm.fccc.edu,
 pmdf-users@icdc.llnl.gov, mark%jrs@ics.uci.edu, byrd@mscf.med.upenn.edu,
 jzj@msr.EPM.ORNL.GOV, wlb@ncifcrf.GOV,
 @RELAY.CS.NET:steve@nemo.math.okstate.edu, pmdf-local@netnews.upenn.edu,
 BOOTH%NHRC.nosc.mil@nosc.mil, x_borge_k%use.uio.uninett@nta-vax.arpa,
 SHERMAN@NUSC.NAVY.MIL, LOCKREY@PNLG.PNL.GOV, rdiaz@PRESTO.IG.COM,
 INFO_PMDF%CCAVAX.CAMB.COM@RELAY.CS.NET, pmdf-list%sh.ac.nz@RELAY.CS.NET,
 infopmdf%rtpark.rtp.ge.com@RELAY.CS.NET,
 INFOPMDF%DELPHI.INTEL.COM@RELAY.CS.NET, gregg%ihlpb.att.com@relay.cs.net,
 AC012125%wkuvx1.wku.edu@RELAY.CS.NET, vasoll%a.cs.okstate.edu@RELAY.CS.NET,
 rvs%bu-it.bu.edu@relay.cs.net, MICRO2.SCHWER%CRVAX.SRI.COM@RELAY.CS.NET,
 CHR%UTRC%utrcgw.utc.com@RELAY.CS.NET, vms-pmdf%ulowell.edu@RELAY.CS.NET,
 info-pmdf%cl.uh.edu@relay.cs.net, newman%gibbs.rutgers.edu@relay.cs.net,
 pmdfnotes%sleepy.egr.msu.edu@relay.cs.net,
 SYSMAN%hilbert%gte-labs.csnet@RELAY.CS.NET,
 RMALOUF%SBMSRC.SUNYSB.EDU@RELAY.CS.NET, BUHLE%XRT@RELAY.UPENN.EDU
X-Vms-To: YMIR::IPMDF

There were a few messages about an interface between NOTES and PMDF/DELIVER on
the info-pmdf lately. In an unrelated conversation thread, I happened to
receive the following contribution that seems to fall in this category. Please
note that I am the second person to pass this on without trying it, but it
presumably does work (or worked). Here it is, with all the gory headers and
everything...

                                Ned

-------------------------------------------------------------------------------

Message-id: <7EDE997D519FC00DB7@YMIR.BITNET>
Received: from CUNYVM.BITNET by YMIR.BITNET; Fri, 21 Jul 89 09:18 PDT
Received: from CUNYVM by CUNYVM.BITNET (Mailer R2.03B) with BSMTP id 6066; Fri,
 21 Jul 89 12:06:27 EDT
Received: from RELAY.CS.NET by CUNYVM.CUNY.EDU (IBM VM SMTP R1.1) with TCP;
 Fri, 21 Jul 89 12:05:50 EDT
Received: from relay2.cs.net by RELAY.CS.NET id ab06300; 21 Jul 89 11:52 EDT
Received: from src.org by RELAY.CS.NET id ah18673; 21 Jul 89 11:48 EDT
Date: Fri, 21 Jul 89 11:20 EDT
From: SHAVA%src.org@RELAY.CS.NET
Subject: deliver file & comfiles for NOTES
To: ned%ymir.bitnet@RELAY.CS.NET
X-VMS-To: IN%"ned@ymir.bitnet"

I *knew* I had this on a tape somewhere!  (I wasn't using notes at the time...)

Hope this proves useful--I haven't cut it up and tried it yet...

                        Shava Nerad Averett
                        shava%src.org@relay.cs.net
===============================================================================



From:    IN%"BAILEY%MORDOR%draper.com@RELAY.CS.NET"  "Tom Bailey, x2476,
 x8-2892"  2-SEP-1988 13:55
To:    shava%isis.mit.edu@RELAY.CS.NET
Subj:    posting interest list mail to NOTES.

Received: from TCP-DAEMON by ISIS.MIT.EDU; Fri, 2 Sep 88 13:54 EST
Received: from relay2.cs.net by RELAY.CS.NET id ag18242; 2 Sep 88 13:31 EDT
Received: from draper.com by RELAY.CS.NET id aa08061; 2 Sep 88 13:11 EDT
Date: Fri, 2 Sep 88 11:38 EDT
From: "Tom Bailey, x2476, x8-2892" <BAILEY%MORDOR%draper.com@RELAY.CS.NET>
Subject: posting interest list mail to NOTES.
To: shava%isis.mit.edu@RELAY.CS.NET
X-VMS-To: CCFVX3::IN%"shava@isis.mit.edu",BAILEY

Shava,
    Enclosed below are some of the files I use to have DELIVER post
interest list messages to selected NOTES conferences.  I have a username
called POST_IT which uses the MAIL.DELIVERY file below.  POST_IT is the
username which is subscribed to the interest lists.  The general idea is
to let DELIVER decide which interest list the message came from by looking
at the TO: field in the message.  This usually works, but doesn't if people
mail to an interest list by CC:'ing the list address.

Also, I added a match by the first word in the subject (after all possible
matches by TO:'s) so that local people would have an easy way to post MAIL
messages to a NOTES conference.  Otherwise it is a real pain to get MAIL
messages into NOTES, if you want to keep individual messages.

The last file is what I use to archive NOTES conferences.  When I think
they are too big, I execute this procedure w/ the desired conference as
a parameter.  You will have to supply an FDL file called NOTE_DUMMY.FDL
of a new NOTES conference in NOTES$LIBRARY.

Let me know if you have questions or make improvements.

        Have fun,
        Tom.

_____________ here is the mail.delivery for POST_IT _______________________
! MAIL.DELIVERY for user POST_IT to post CS-net interest list items
!        to VAX NOTES conferences.
!        Parse interest list mail by TO: address (the master
!        re-distribution list).
!        Call command file to post the message to the appropriate
!        Notes conference.  You must know the name of the
!        Notes conference.
!
!             Also, parse by first word of SUBJECT:.  This allows
!        VAX MAIL messages to be posted to a Notes conference
!        by forwarding them to POST_IT with the appropriate first
!        word of the subject.
!
!        Currently we allow the incoming message to be placed in
!               ONLY ONE Notes conference, the first one matched.
!
! TO ADD A NEW INTEREST LIST:
!    1) Create a new unrestricted Notes conference.
!    2) Add a directive line to match the TO: field in the first section
!        below.  You will probably have to receive a few messages
!        first to note what the TO: field should be.
!    3) Add a directive line to match the SUBJECT: field in the second
!        section below.  This allows local users to post messages
!        to the conference via DELIVER using an appropriate Subject
!        value.
! TO ADD A NEW LOCAL CONFERENCE:
!    1) Create a new unrestricted Notes conference.
!    2) Add a directive line to match the SUBJECT: field in the second
!        section below.  This allows local users to post messages
!        to the conference via DELIVER using an appropriate Subject
!        value.
!
! Written by Tom Bailey, 8/11/88
!----------------------------------------------------------------------------
! Match network interest lists first, by TO: field
!
!    PMDF interest list, Notes conference: PMDF_CS
* "*ipmdf*"    * T E "@POST_IT_NOTE/output=pmdf.log PMDF_CS"
* "*info-pmdf*"    * T E "@POST_IT_NOTE/output=pmdf.log PMDF_CS"
!    AMIGA interest list, Notes conference: AMIGA_CS
* "*amiga*"    * T E "@POST_IT_NOTE/output=amiga.log AMIGA_CS"
!    Simulation interest list, Notes conference: SIMULATION_CS
* "*simulation*" * T E "@POST_IT_NOTE/output=simulation.log SIMULATION_CS"
!    Info-VAX interest list, Notes conference: INFO_VAX_CS
* "*info-vax*"    * T E "@POST_IT_NOTE/output=info_vax.log INFO_VAX_CS"
!    Scheme interest list, Notes conference: SCHEME_CS
* "scheme*"    * T E "@POST_IT_NOTE/output=SCHEME.log SCHEME_CS"
!    Common Lisp interest list, Notes conference: COMMON_LISP_CS
* "*common-lisp*"    * T E "@POST_IT_NOTE/output=COMMON_LISP.log COMMON_LISP_CS"
* "cl*"        * T E "@POST_IT_NOTE/output=COMMON_LISP.log COMMON_LISP_CS"
!          Info-MAC interest list, Notes conference: INFO_MAC_CS
* "*info-mac*"    * T E "@POST_IT_NOTE/output=INFO_MAC.log INFO_MAC_CS"
!    Info-high-audio interest list, Notes conference: INFO_HIGH_AUDIO_CS
* "*info-high-audio*"    * T E "@POST_IT_NOTE/output=INFO_HIGH_AUDIO.log
 INFO_HIGH_AUDIO_CS"
!    NA (numerical analysis) interest list, Notes conference:
 NUMERICAL_ANALYSIS_CS
* "NA@*"    * T E "@POST_IT_NOTE/output=NUMERICAL_ANALYSIS.log
 NUMERICAL_ANALYSIS_CS"
!    Neuron list, Notes conference: NEURON_CS
* "*neuron*"    * T E "@POST_IT_NOTE/output=NEURON.log NEURON_CS"
!    CA (cellular automata) interest list, Notes conference: CELL_AUTOMATA_CS
* "CA@*"    * T E "@POST_IT_NOTE/output=CELL_AUTOMATA.log CELL_AUTOMATA_CS"
!------------------------------------------------------------------------------
! Match mail by SUBJECT:.  Intended to allow posting of local mail items
!    to Notes conferences.  Only post mail matched by subject if no
!    previous directive applied to prevent posting net mail twice in
!    the same conference.
!
!    Notes conference: PMDF_CS
* * "pmdf*"        O E "@POST_IT_NOTE/output=pmdf.log PMDF_CS"
!    Notes conference: AMIGA_CS
* * "amiga*"        O E "@POST_IT_NOTE/output=amiga.log AMIGA_CS"
!    Notes conference: SIMULATION_CS
* * "simulation*"    O E "@POST_IT_NOTE/output=simulation.log SIMULATION_CS"
!    Notes conference: INFO_VAX_CS
* * "info_vax*"        O E "@POST_IT_NOTE/output=info_vax.log INFO_VAX_CS"
!    Scheme interest list, Notes conference: SCHEME_CS
* * "scheme*"        O E "@POST_IT_NOTE/output=SCHEME.log SCHEME_CS"
!    Common Lisp interest list, Notes conference: COMMON_LISP_CS
* * "common_lisp*"    O E "@POST_IT_NOTE/output=COMMON_LISP.log COMMON_LISP_CS"
!          Info-MAC interest list, Notes conference: INFO_MAC_CS
* * "info_mac*"        O E "@POST_IT_NOTE/output=INFO_MAC.log INFO_MAC_CS"
!    Info-high-audio interest list, Notes conference: INFO_HIGH_AUDIO_CS
* * "info_high_audio*"    O E "@POST_IT_NOTE/output=INFO_HIGH_AUDIO.log
 INFO_HIGH_AUDIO_CS"
!    NA (numerical analysis) interest list, Notes conference:
 NUMERICAL_ANALYSIS_CS
* * "num_anal*"        O E "@POST_IT_NOTE/output=NUMERICAL_ANALYSIS.log
 NUMERICAL_ANALYSIS_CS"
!    Neuron list, Notes conference: NEURON_CS
* * "neuron*"        O E "@POST_IT_NOTE/output=NEURON.log NEURON_CS"
!    CA (cellular automata) interest list, Notes conference: CELL_AUTOMATA_CS
* * "cell_auto*"    O E "@POST_IT_NOTE/output=CELL_AUTOMATA.log
 CELL_AUTOMATA_CS"
!
!     VAX ELN local Notes conference: ELN_THINGS
* * "eln*"        O E "@POST_IT_NOTE/output=eln.log ELN_THINGS"
!    Local news Notes conference: RPL_LOCAL_NEWS
* * "local*"        O E "@POST_IT_NOTE/output=local.log RPL_LOCAL_NEWS"
!    Software tools local Notes conference: SOFTWARE_TOOLS
* * "software*"        O E "@POST_IT_NOTE/output=soft.log SOFTWARE_TOOLS"
!    TB testing  local news Notes conference: TBTEST
* * "test*"        O E "@POST_IT_NOTE/output=test.log TBTEST"
!----------------------------------------------------------------------------
!  forward any previously unmatched messages to Tom Bailey: username BAILEY
* * * O E "@FORWARD_UNKNOWN BAILEY"
-------------- end of mail.delivery -------------------------------------

-------------- start of post_it_note.com, used by DELIVER for POST_IT ---
$! Command procedure to post a file to a desired Notes conference.
$! Conference name is passed via P1.
$! File to be posted is in MESSAGE_FILE.
$! Symbols FROM, TO, and SUBJECT have the corresponding information from
$!     the incoming mail message.  We add them to the top of the message
$!    file.
$!Tom Bailey 8/11/88
$!-----------------------------------------------------------------------
$!
$! get filename of message file to be used for temporary files.
$ temp_file = f$parse(MESSAGE_FILE,,,"NAME")
$ temp_mess_file = temp_file + ".tmpm"
$ temp_com_file = temp_file + ".tmpc"
$!
$!  debugging stuff.
$ sho default
$ sho sym/all/local
$ sho log
$ type 'temp_file'.com
$!
$!  Open temp message file, write header stuff, and append message file.
$ open/write temp 'temp_mess_file'
$ write temp "FROM:    " + FROM
$ write temp "TO:      " + TO
$ write temp "SUBJECT: " + SUBJECT
$ write temp " "
$ close temp
$ append 'MESSAGE_FILE' 'temp_mess_file'
$!
$! create and execute a temporary command file to actually post the note.
$!    A temporary command file is needed because symbols don't expand
$!    in DCL data statements.
$ open/write temp 'temp_com_file'
$ write temp "$ NOTES /NONOTEBOOK ''P1'"
$ write temp "WRITE /NOEDIT ''temp_mess_file'"
$ write temp "''SUBJECT'"
$ write temp "Y"
$ write temp "SHOW ERROR"
$ write temp "EXIT"
$ write temp "$ EXIT"
$ close temp
$ @'temp_com_file'
$!
$! delete our temporary files. get full names first.
$ temp_com_file = f$parse(temp_com_file)
$ temp_mess_file = f$parse(temp_mess_file)
$ delete 'temp_com_file','temp_mess_file'
$!
$! clean up directory.  assume that we won't lose anything important by
$!    purging.
$ purge *.log/keep=2
$!
$ exit
----------------- end of post_it_note.com ------------------------------

---------- start of forward_unknown.com, used by DELIVER for POST_IT ---
$! Command procedure to forward an unmatched message to a chosen username.
$! For use w/ DELIVER.
$! Chosen username is passed via P1.
$! Unmatched message is in MESSAGE_FILE.
$! Symbols FROM, TO, and SUBJECT have the corresponding information from
$!     the incoming mail message.  We add them to the top of the message
$!    file.
$!Tom Bailey 8/15/88
$!-----------------------------------------------------------------------
$!
$!  debugging stuff.
$ sho default
$ sho sym/all/local
$ type 'temp_file'.com
$!
$! get filename of message file to be used for temporary files.
$ temp_file = f$parse(MESSAGE_FILE,,,"NAME")
$ temp_mess_file = temp_file + ".tmpm"
$!
$!  Open temp message file, write header stuff, and append message file.
$ open/write temp 'temp_mess_file'
$ write temp "FROM:    " + FROM
$ write temp "TO:      " + TO
$ write temp "SUBJECT: " + SUBJECT
$ write temp " "
$ close temp
$ append 'MESSAGE_FILE' 'temp_mess_file'
$!
$! mail the modified message to the chosen username.
$ mail/noself/subject="Unmatched mail" 'temp_mess_file' 'P1'
$!
$! delete our temporary files. get full names first.
$ temp_mess_file = f$parse(temp_mess_file)
$ delete 'temp_mess_file'
$!
$ exit
-------------- end of forward_unknown.com ------------------------------

-------- start of note_archive.com, used to archive a NOTES conference ---
$! procedure to archive a selected NOTES conference.
$! Created by Tom Bailey, 8/31/88
$!-----------------------------------------------------------------------
$! There are some potential problems with this set-up, but it will work
$!    most of the time.  The problems I know about are:
$!    1) some messages may get archived but not deleted from the main
$!        NOTES conference if a new message comes in after the
$!        directory of the conference has been done.
$!    2) the convert/reclaim locks the NOTES file, so that any batch
$!        process that is trying to post a note will fail, and the
$!        message will be lost.
$! One solution that takes care all notes posted by DELIVER is to stop
$!    the DELIVER queue and restart after all the sensitive operations
$!    are done.
$! Also, only one process should run this procedure at-a-time. Otherwise,
$!    things will get messed up because of non-unique file names.
$! The USERNAME that this procedure run under must be a moderator for the
$!    desired NOTES conference.
$!------------------------------------------------------------------------
$! NOTES file name to be archived comes in through P1.
$!
$ set process/priv=all
$ set def notes$library
$ set protection=w:rwe/default
$ on error then goto end
$!
$! get date, and form archival file name.
$ time = f$time()
$ year = f$cvtime(time,,"year")
$ month = f$cvtime(time,,"month")
$ day = f$cvtime(time,,"day")
$ arc_file = P1 + "_" + YEAR + "_" + MONTH + "_" + DAY + ".NOTE"
$!
$! open conference and get a listing of notes that will be archived.
$ notes 'p1'
dir/output=note_del.tmp *.*
close
exit
$!
$! use convert to make a copy of the notes conference.
$ convert/share 'p1'.note 'arc_file'
$!
$! call subroutine to process directory of conference and to determine
$!    the number of the 1st and last notes in the conference.
$ call make_del_file   'p1' note_del.tmp 'p1'.tmp
$!
$! goto a subroutine to add a note telling what we archived and where it
$!    is.
$ gosub add_archive_note
$!
$! Now delete all the archived notes from the conference by executing the
$!    command file that make_del_file created.  Do this twice to remove
$!    any notes that were TOPICs which had replies.
$ @'p1'.tmp
$ @'p1'.tmp
$!
$! Reclaim buckets in main conference.  Then make a new version of the file
$!    using the FDL of a new NOTES conference so that we can recover some
$!    of the disk space used by the delete notes.
$ convert/reclaim/statistics 'p1'.note
$ convert/fdl=note_dummy.fdl /create /statistics 'p1'.note 'p1'.note
$ delete 'p1'.note;-1
$!
$! clean up stuff.
$ delete 'p1'*.tmp*;*/log
$ delete note_del*.tmp;*/log
$!
$! End of procedure.
$end:
$ exit
$!
$!
$add_archive_note:
$! add note to tell what we archived and where it went.
$! Put note text into a file, then post the file as a note.
$ open/write tmp note_del2.tmp
$ write tmp "     Notes ''first' through ''last' have been archived to the"
$ write tmp "     NOTES conference ''arc_file' ."
$ write tmp " "
$ write tmp "     You can look at any old notes by adding the archive "
$ write tmp "     conference to your NOTES notebook."
$ close tmp
$ notes 'p1'
write/noedit note_del2.tmp
PREVIOUS NOTES HAVE BEEN ARCHIVED
Y
close
exit
$ return
$!
$!
$MAKE_DEL_FILE: SUBROUTINE
$! subroutine to process the output of a NOTES dir *.*  to create a command
$!   file which can be used to delete all the notes in a conference.
$! Also, puts the numbers of the first and last notes into the global symbols
$!   FIRST and LAST, respectively.
$! The name of the notes conference is passed in through P1.
$! The name of the file which contains a conference directory listing is
$!    P2.
$! The name of the file which will contain the commands to delete the
$!    selected notes is P3.
$!
$ open/read in 'p2'
$ open/write out 'p3'
$!
$! write out misc. commands at the start of the command file.
$ write out "$ notes ''p1'"
$ write out "set moderator"
$!
$ first == ""
$ last == ""
$!
$!skip 1st 5 lines (header of listing)
$ read in line
$ read in line
$ read in line
$ read in line
$ read in line
$!
$! don't need verify for around this loop
$ set nover
$! start processing loop.
$loop:
$! get line to parse.
$ read/end=end_sub/err=end_sub in line
$! try to get topic number: characters 1-8 of line. collapse spaces, etc.
$ note_num = f$extract(0,8,line)
$ note_num = f$edit(note_num,"collapse,upcase")
$ if note_num.nes."" then write out "delete note ''note_num'"
$ if note_num.nes."" then write out "Y"
$ if first.eqs."" then first == note_num
$ if note_num.nes."" then goto loop
$! try to get reply number. if topic is null, then this is a reply note.
$!   if a topic, then reply number is 4th parameter on line,
$!   if a reply, then reply number is 3rd parameter on line.
$! Use a call w/ line as parameter so DCL will parse the fields for us.
$ call parse_reply 'line'
$ note_num = reply_3
$ write out "delete note ''note_num'"
$ write out "Y"
$ if first.eqs."" then first == note_num
$ goto loop
$!
$end_sub:
$! turn on verify again.
$ set ver
$ last == note_num
$ write out "close"
$ write out "exit"
$ write out "$ exit"
$ close in
$ close out
$ exit
$ endsubroutine
$!
$! subroutine to get reply number of a note.
$parse_reply: subroutine
$ reply_3 == p3
$ exit
$ endsubroutine
--------------- end of note_archive.com ----------------------------
