PC Ext: External P1 File Locking Is Different in Each Version
PSS ID Number: Q112895
Article last modified on 10-29-1994
PSS database name: PCMAIL

2.10 3.00 3.20
WINDOWS

-----------------------------------------------------------------------
The information in this article applies to:

 - Microsoft Mail for PC Networks, versions 2.1, 3.0, and 3.2
-----------------------------------------------------------------------

Versions 2.1 and later of Microsoft Mail for PC Networks all use slightly
different methods of dispatching mail when multiple instances of the
External Mail program (EXTERNAL.EXE) access the same source postoffice.

Versions 2.1x
-------------
Microsoft Mail 2.1x uses a command-line parameter to ensure proper
transmission of mail. As explained on page 204 of the version 2.1c
"Administrator's Guide," the -P0xx option is required whenever multiple
Externals send mail from a single postoffice. For example:

   external -hm -dmo -p005

External processes mail in the following manner:

1. External polls all externally defined postoffices (.MBG files) until it
   finds mail queued.
2. External locks the MBG file with a corresponding prefix and the -P0xx
   suffix.
3. External copies the corresponding 00000001.MAI file(s) into its local P1
   directory using the corresponding prefix and the -P0xx suffix. For
   example:
    - 00000009.MBG gets locked in the local P1 directory as 00000009.P05.
    - 00000001.MAI is copied as 0000001.P05.
4. External copies the 00000001.P005 file from the source postoffice to the
   target postoffice using a new prefix (which is assigned from the
   destination postoffice's CONTROL.GLB file) and a P1 suffix. For example:
    - 00000001.P05 is copied as 000002AF.P1
5. The .P05 file is deleted from the source PO immediately after the
   message is moved (and therefore, before the Mailer portion of External
   runs).
6. The *.P1 file on the target postoffice is deleted after Mailer is run on
   the target.

Version 3.0
-----------
Versions 3.0 through 3.0.3 of Microsoft Mail no longer require the use of
the -P0xx command-line parameter. With versions 3.0 through 3.0.3, External
also creates a unique .P1 file in the destination P1 directory, but instead
of using a command-line parameter for the suffix of the source P1 file
(P005), it now performs a two-stage verification:

1. External creates a corresponding .OLK file. This file locks the actual
   mailbag for the postoffice for which External is delivering mail,
   preventing other External Mail programs from processing that mailbag.
2. External copies the mail in the queue to the local P1 directory with
   a corresponding prefix and .P00 suffix. For example:
    - 00000009.MBG gets locked in the local P1 directory as 00000009.0LK.
    - 00000001.MAI is copied as 0000001.P00.
    - In the destination postoffice's P1 directory, the mail is created as
      000002AF.P1.

In addition to the above, External version 3.0.4 will account for a second
External Mail program processing the same message (destined for another
user on another postoffice). External numerically increments the value for
the suffix of the message file in the local P1 directory by one: P00
through P99. For example:

 - 00000009.MBG gets locked in the local P1 directory as 00000009.0LK.
 - 00000001.MAI is copied as 00000001.P01 if the 00000001.P00 file is
   present.
 - In the destination postoffice's P1 directory, the mail is created as
   000002AF.P1.

Once the message is successfully delivered to the recipients, all active
.0LK, .Pxx, and .P1 files are deleted.

Version 3.2
-----------
Microsoft Mail 3.2 modified the two-stage locking and added a third level:
1. External creates a corresponding .OLK file.
2. External reserves a unique suffix for all mail in the queue with a new
   file called LOCKP1ID.Pxx. If there are other LOCKP1ID.Pxx files in the
   local P1 directory, the .Pxx file increments alphabetically: the range
   is Pbb through Pzz. (Paa is not used because of the way Mail constructs
   filenames for .MAI and .ATT files. Once this file is created for
   External's cycle, it remains locked for the entire duration of the
   connection.
3. While External has the mail locked, it copies the mail messages into the
   P1 directory with the corresponding prefix of the message and the same
   suffix of the LOCKP1ID file. For example:

    - 00000009.MBG gets locked in the local P1 directory as 000000009.0LK
    - External scans mail in the queue and creates a LOCKP1ID.PBB file.
    - 00000001.MAIL is copied as 00000001.PBB.
    - 00000002.MAIL is copied as 00000002.PBB.
    - 00000003.MAIL is copied as 00000003.PBB.
    - In the destination postoffice's P1 directory, the mail is created as
      000002AF.P1, 000002B0.P1, and 000002B1.P1.
   (NOTE: A second External program would create a LOCKP1ID.PBC file and
   all its files would have the .PBC extension.)

Once the message is successfully delivered to the recipients, all active
.0LK, .LOCKP1ID. Pxx, and .P1 files are deleted.

Additional reference words: 2.10 3.00 3.20
KBCategory: kbenv kbusage
KBSubCategory: MailPCExt

=============================================================================
Copyright Microsoft Corporation 1994.