::****************************************************************::
:: jumblmsg.btm v2.0                                              ::
::                                                                ::
:: Copyright 1995 by Mike Roberts - FIDO: 1:128/126               ::
:: All Rights Reserved                                            ::
::                                                                ::
:: Release Date: February 26, 1995                                ::
::----------------------------------------------------------------::
:: Purpose: Randomly reorder *.msgs in mailer message directory   ::
::          Performs mailer queue optimization.                   ::
::                                                                ::
:: Syntax : JUMBLMSG ?                 ? - Full screen help       ::
::          JUMBLMSG                   Randomly Reorder           ::
::          JUMBLMSG [R] [S] [F<L>]    R - Reorder only           ::
::                                     S - Skip READ/SENT/LOCK    ::
::                                     F - FrontDoor Mode         ::
::                                     L - FrontDoor Logging      ::
::                                                                ::
:: Comments:  Now supports generic mailers and adds special       ::
::            support for FrontDoor v2.02 and above.  Supports    ::
::            multitasking operations, reads FrontDoor            ::
::            configuration file (SETUP.FD).  Safely renumbers    ::
::            messages in FrontDoor mail directory through the    ::            use of semaphores as outlined in FDDEV220.  Supports::
::            optional switch to passover READ, SENT, and LOCKED  ::
::            netmail messages.                                   ::
::                                                                ::
::----------------------------------------------------------------::
:: This .BTM requires Rex Conn's 4DOS v5.5x and may be modified   ::
:: for personal use only.  May not be sold or reproduced in for   ::
:: profit ventures without prior written consent of author.  May  ::
:: be freely distributed as long as the source code is unmodified.::
::****************************************************************::


1.0  Purpose


JUMBLMSG.BTM is a 4DOS BTM that I wrote to take care of what I consider
to be an annoying characteristic of the FrontDoor mailer system.  The
"dynamic" nature of the FrontDoor outbound queue is one of FrontDoor's
strengths and also one of it's weaknesses.  Here's the scenario:

  You decide to FREQ:  FILES from every member in your net.  This
  generates a little over 100 netmail messages in your outbound.
  FrontDoor builds it's queue and starts dialing the node in the
  numerical order that the *.MSGs appear in the mail directory.

  It skips the numbers that are busy and for which there is no connect.
  When it does connect it marks the corresponding message as sent or
  deletes it depending on how the Kill/Sent bit is set on the message.
  When FrontDoor does connect it exits with an errorlevel and then
  returns and rebuilds the queue.  Soon by a process of "natural
  selection" the first dozen or so *.MSG in your mail directory are destined
  for nodes that are either down or perpetually busy.  FrontDoor has to
  wade through calling all those nodes before it gets to the next number
  that has not been called yet!

JUMBLMSG reads the directory where your outbound *.MSG reside and
renames them randomly so that when FrontDoor rebuilds it's queue the
order of the nodes to be called is different.  So you don't end up with
a msg named 89765800.MSG in your mail directory the next step it takes is to
"pack" the message numbers by renumbering 1 through whatever
sequentially.

If the "jumble" feature is not for you then JUMBLMSG can optionally
skip the randomize function and proceed directly to the "pack" function.



1.1  New features in JUMBLMSG v2.0


* Optional binary read of message READ/SENT, Locked status.  Will not
  randomize these messages.  The net effect is that JUMBLMSG when used
  with the 'S' parameter "moves" your READ/SENT and LOCKED messages to
  the front of the queue.

* Improved ERROR trapping

* Detailed report of number of messages processed.

* Elapsed time display

* NEW FrontDoor support

  > Directly reads FrontDoor SETUP.FD and uses filenames and pathes.

  > Optionally logs report to FrontDoor logfile.

  > Supports semaphores for SAFE multiline operation


2.0  Using JUMBLMSG With A Generic Mailer:


Make sure that you run JUMBLMSG directly from the directory where your
*.MSGs reside.  This can be accomplished by using JUMBLMSG from a
batchfile like so:

  cdd c:\bink\mail
  jumblmsg

SYNTAX:

  JUMBLMSG    <- Randomize and reorder

  JUMBLMSG ?  <- this help

  JUMBLMSG r  <- Reorder only

  JUMBLMSG s  <- Skips READ/SENT, Locked messages.


The default commandline (no parameters) randomizes all messages in your
mail directory and then reorders them sequentially.  For example:

2.MSG => 1.MSG
3.MSG => 3.MSG
5.MSG => 2.MSG


The 'R' option just reorders messages (packs them) without randomizing
(jumbling them.)  For example:

2.MSG => 1.MSG
3.MSG => 2.MSG
5.MSG => 3.MSG


The 'S' option packs the READ/SENT, and LOCKED messages, and then
randomizes the others so that they are higher numbered than the
'SKIPPED' messages.  For example:

SENT    2.MSG => 1.MSG
        3.MSG => 5.MSG
LOCKED  5.MSG => 2.MSG
        6.MSG => 4.MSG
READ    7.MSG => 3.MSG


NOTE:  When 'R' and 'S' are used together 'R' takes precedence and the
messages are simply reordered without checking READ/SENT, LOCKED status.

There is also a speed penalty when using 'S' since 4DOS has to a binary
open, read, and close on each message in order to determine the msg bit
status.  If you never keep READ/SENT or LOCKED messages in your mail
directory it's probably best to omit the 'S' parameter.


NOTE:  It is safe to hit control break at ANY time.  JUMBLMSG can be
halted at any point without any problems.



2.1  Using JUMBLMSG With FrontDoor:


The parameters listed above in paragraph 2.0 are also used in FrontDoor
mode.  Additionally  there are a few FrontDoor specific parameters.

SYNTAX:

  JUMBLMSG f  <- Tells JUMBLMSG to read info from SETUP.FD

  JUMBLMSG fl <- Tells JUMBLMSG to read info from SETUP.FD and log
                 activity to the FrontDoor log file.

When used in FrontDoor mode JUMBLMSG can be run from any directory.  The
program will look for SETUP.FD by looking at the %FD variable, if %FD is
not found it will look in the directory where it is run from.



3.0  Considerations with generic mailer


Not too many really.  The program is well error trapped and will tell
you if anything is wrong.  Let me know if it doesn't.



3.1  Considerations with FrontDoor:


JUMBLMSG looks for SETUP.FD in accordance with the author's
recommendations.  It looks for the %FD variable and then in the current
directory.  While parsing SETUP.FD you will be notified of any errors
generated.

You must have a MAIL DIRECTORY specified in FDSETUP for JUMBLMSG to run.
Then again you must have a MAIL DIRECTORY specified for FrontDoor to run
so I don't see too much of a problem there.


JUMBLMSG only works with versions of FRONTDOOR later than 1.99b.


3.2  Using JUMBLMSG with FrontDoor 2.02:


None really, should pick up from SETUP.FD where your mail is stored and
the name of your logfile and work correctly.  Make sure you run it when
FrontDoor is NOT active (i.e. your main batchfile) to avoid problems
accessing the logfile.



3.3  Using JUMBLMSG with FrontDoor 2.11+:


JUMBLMSG should pick up from SETUP.FD where your mail is stored and
the name of your logfile and work correctly.  Make sure you run it when
FrontDoor is NOT active (i.e. your main batchfile) to avoid problems
accessing the logfile.

Make SURE it is run when FrontDoor is down.  There are a lot of people
running multi-line with the shareware versions and it's up to YOU to
make it work.  Since the shareware versions are not TASK aware
SEMAPHORES are not used when JUMBLMSG detects the shareware version.
This should not be a problem if you run JUMBLMSG in the same batchfile
that runs FrontDoor, and NOT in a separate window while Front Door is
running in another.



3.4  Using JUMBLMSG with FrontDoor 2.20+:

  
JUMBLMSG fully supports the MultiLine version of FrontDoor and can be
run at any time.  One caveat, the version number for FrontDoor is NOT in
SETUP.FD so I had to kludge that a little.  For JUMBLMSG to detect that
you are running MultiLine it needs to see a path in the SEMAPHORE
section of FDSETUP.  If it doesn't find a path for your SEMAPHORE
directory it will default to 2.11+ mode.

JUMBLMSG will wait up to two minutes for FrontDoor to report it is safe
to renumber the mail queue.  After two minutes it will terminate so that
a hung task in one window won't hang the task that is running JUMBLMSG.

JUMBLMSG also 'freezes' FM (the editor) and waits for it to report that
it is frozen before proceeding.  It will beep every two seconds while
waiting for FM to freeze, so make sure you save your message before the
editor (FM) freezes (this only applies if you are editing a message in
your mail directory.)

After JUMBLMSG is finished it will unfreeze FM and will tell FM to
rescan the folder and also tells all other TASKS to rescan the queue.

Lastly if you use the $TASK$ variable in your logfile name under FDSETUP
then you must set the task in your environment.  If FrontDoor has the
logfile open while JUMBLMSG tries to log data, a harmless message will
be generated.



4.0 JUMBLMSG errorlevels:

STANDARD MODE:

elevel=0  <- normal termination
elevel=1  <- no *.msg found to work on
elevel=2  <- user requested termination via break

FRONTDOOR MODE:

elevel=3  <- timeout waiting for semaphore to clear
elevel=4  <- cannot process SETUP.FD ('F' parameter)
elevel=5  <- error writing FrontDoor log ('L' parameter)
elevel=6  <- disk access error (disk full or write protected)
elevel=7  <- no mail directory specified in FDSETUP

MISCELLANEOUS:

elevel=8  <- couldn't find JUMBLMSG.HLP
elevel=9  <- incorrect 4DOS version
elevel=10 <- normal termination after reading help


This should work on ANY system running 4DOS v5.5 or greater.  The colors
may be a little funky if your screen does not have a black background.



5.0  Bug reports, etc.


I can promise you that JUMBLMSG worked fine during testing.  I can also
tell you that I don't see how it could cause any problems on your
system.  If it does please let me know.

Post any bug reports in the 4DOS echo or send them to Mike Roberts at
1:128/126.  If it won't run on your system I will see what I can do.

Please read the accompanying REGISTER.TXT file.

THANKS!


Mike


EOF JUMBLMSG.HLP
