Article 147896 of comp.os.vms:

In article <4nh2v0$ohh@rzsun02.rrz.uni-hamburg.de>, Phillip Helbig <phelbig@hs.uni-hamburg.de> writes...

>While I'm thinking of it---what exactly does COMPRESS in MAIL do and when
>should I use it? 

Is uses (callable) CONVERT to recreate your mail using an 'undersized' FDL 
causing all records to be packed in a minimal space. You use it when you
'feel' that the performance on you mail file is degrading too much, or when
you are desperate to squeeze out those last few free blocks. As convert only
reads through the primary data buckets of the mail indexed file, it will
happily ingnore any index structure corruption. Thus an other reason to use
compress, albeit a desperate one, is to try to recover from file corruption.

If compress is used for performance reasons, I personally prefer NOT to 
take minimal space, as MAIL files tend to grow back over time anyway and
underallocation leads to, often severe, fragmentation giving poor performance.
For that reason I use the included command file with looks at the current
size of MAIL.MAI (in current directory) and selects the what it believes
to be appropriate FLD commands to convert the file with.


$! MAIL_CONVERT.COM   Cleans up and optimizes VMSmail indexed files.
$!                    Hein van den Heuvel, March 1996
$
$  BIG =  5000
$  SMALL = 500
$
$! This command file will convert the MAIL.MAI file in the current
$! directory selecting a reasonable FDL file based on the current size.
$! It will NOT compress as agressivly as standard MAIL COMPRESS would
$! do as it is believed that current mail file size is an indication
$! of the future size.
$! It makes an attempt to protect against incoming mail during the convert.
$! Such new mail would create a fresh MAIL.MAI file which is merged in.
$!	 Hein van den Heuvel
$!
$if f$search("mail.mai").eqs."" then goto help
$open/read/write/erro=help x mail.mai 
$close x
$size = f$file ("mail.mai","alq")
$gbc  = f$file ("mail.mai","gbc")
$set prot mail.mai;*
$rena/log mail.mai;* mail.old;*
$!
$! Select the convert with appropriate FDL
$!
$if size.gt.big then goto big_fdl
$if size.lt.small then goto small_fdl
$goto medium_fdl
$! 
$! Come back here after convert and make sure no new mail has arrived
$!
$newmail:
$set noon
$if f$search("mail.mai").eqs."" then goto nonews
$write sys$output "New MAIL.MAI file appeared. Merging in with .NEW file."
$convert/merge/stat MAIL.MAI MAIL.NEW
$set prot MAIL.MAI
$delete/conf MAIL.MAI.
$goto newmail
$
$nonews:
$rena/log mail.new mail.mai
$set prot=(ow:rw,sy:rw,gr,wo) mail.mai
$if gbc.gt.0 then set file/global='gbc' mail.mai
$dele/conf mail.old.*
$exit
$
$big_fdl:
$conv/fast/stat/nosort/fdl=sys$input mail.old mail.new
FILE; ORG indexed; RECORD;	FORMAT variable; SIZE 2048
AREA 0; BEST_TRY_CONTIGUOUS yes; BUCKET 12; ALLOCATION 3600; EXTENSION 1200;
AREA 1;	BEST_TRY_CONTIGUOUS yes; BUCKET 12; ALLOCATION   60; EXTENSION   60;
AREA 2;	BEST_TRY_CONTIGUOUS yes; BUCKET 12; ALLOCATION  120; EXTENSION   60;
KEY 0; DATA_KEY_COMPR no; DATA_RECORD_COMPR yes; INDEX_COMPRES no
       DATA_AREA  0; DATA_FILL 100; DUPLICATES no; PROLOG 3
       INDEX_AREA 1; INDEX_FILL 100; LEVEL1_INDEX_AREA 1
       SEG0_LENGTH 8; SEG0_POSITION 0; TYPE bin8
KEY 1; DATA_KEY_COMPR yes; INDEX_COMPR yes; NULL_KEY yes; NULL_VALUE 0
       DATA_AREA 2; DATA_FILL 70; CHANGES yes; DUPLICATES yes
       INDEX_AREA 2; INDEX_FILL 90; LEVEL1_INDEX_AREA 2
       SEG0_LENGTH  39; SEG0_POSITION 9; TYPE string
$
$goto newmail
$
$medium_fdl:
$conv/fast/stat/nosort/fdl=sys$input mail.old mail.new
FILE; ORG indexed; RECORD;	FORMAT variable; SIZE 2048
AREA 0; BEST_TRY_CONTIGUOUS yes; BUCKET  6; ALLOCATION  600; EXTENSION  300;
AREA 1;	BEST_TRY_CONTIGUOUS yes; BUCKET  6; ALLOCATION   30; EXTENSION   30;
AREA 2;	BEST_TRY_CONTIGUOUS yes; BUCKET  6; ALLOCATION   60; EXTENSION   30;
KEY 0; DATA_KEY_COMPR no; DATA_RECORD_COMPR yes; INDEX_COMPRES no
       DATA_AREA  0; DATA_FILL 100; DUPLICATES no; PROLOG 3
       INDEX_AREA 1; INDEX_FILL 100; LEVEL1_INDEX_AREA 1
       SEG0_LENGTH 8; SEG0_POSITION 0; TYPE bin8
KEY 1; DATA_KEY_COMPR yes; INDEX_COMPR yes; NULL_KEY yes; NULL_VALUE 0
       DATA_AREA 2; DATA_FILL 70; CHANGES yes; DUPLICATES yes
       INDEX_AREA 2; INDEX_FILL 90; LEVEL1_INDEX_AREA 2
       SEG0_LENGTH  39; SEG0_POSITION 9; TYPE string
$
$goto newmail
$
$small_fdl:
$conv/fast/stat/nosort/fdl=sys$input mail.old mail.new
FILE; ORG indexed; RECORD;	FORMAT variable; SIZE 2048
AREA 0; BEST_TRY_CONTIGUOUS yes; BUCKET  6; ALLOCATION   60; EXTENSION   60;
AREA 1;	BEST_TRY_CONTIGUOUS yes; BUCKET  6; ALLOCATION    6; EXTENSION   30;
AREA 2;	BEST_TRY_CONTIGUOUS yes; BUCKET  6; ALLOCATION   12; EXTENSION   30;
KEY 0; DATA_KEY_COMPR no; DATA_RECORD_COMPR yes; INDEX_COMPRES no; 
       DATA_AREA  0; DATA_FILL 100; DUPLICATES no; PROLOG 3; 
       INDEX_AREA 1; INDEX_FILL 100; LEVEL1_INDEX_AREA 1
       SEG0_LENGTH 8; SEG0_POSITION 0; TYPE bin8;
KEY 1; DATA_KEY_COMPR yes; INDEX_COMPR yes; NULL_KEY yes; NULL_VALUE 0
       DATA_AREA 2; DATA_FILL 70; CHANGES yes; DUPLICATES yes;
       INDEX_AREA 2; INDEX_FILL 90; LEVEL1_INDEX_AREA 2
       SEG0_LENGTH  39; SEG0_POSITION 9; TYPE string
$
$goto newmail
$
$help:
$type sys$input

	MAIL.MAI file note found, or could not be opened exclusivly (in use).
	Please execute this command file while default set to mail directory.
	Exit from any and all active VMSmail/DECwindowsmail processed.

$exit

Hope this helps,		+--------------------------------------+
Hein van den Heuvel, Digital.	| All opinions expressed are mine, and |
  "Makers of VMS and other	| may not reflect those of my employer |
   fine Operating Systems."	+--------------------------------------+


