The Question is:
How do I rebuild a mail.mai file that has become corrupt? I need it to reflect
existing messages in mailbox.
The Answer is :
Check that you have current ECOs for the XQP and RMS, for CONVERT, for
the disk driver(s) involved, and for OpenVMS itself.
Most obviously, restore the file from backup.
First RENAME the broken MAIL.MAI file to a name such as MAIL.BROKEN, to
ensure that no new messages are written into the corrupt file, and to
ensure that a copy of the corrupt file will remain available. Make a
BACKUP copy of this broken file, and (once recovered) the new file.
Mail will create a mail file when a message is received and no existind
mail file is not found, and you can then try to merge in as many records
possible into the new file from the corrupt file.
You may be able to retrieve records using either the primary or (as
shown here) an "alternate" key to read and recreate the data:
$ CONVERT/KEY=1/STAT mail.broken mail.key_1
You may also need to use a homegrown program or a DCL script to read and
transfer the records:
$ OPEN/READ broken mail.broken
$ OPEN/READ/WRITE/SHARE=WRITE new mail.mai
$ READ broken record
$ WRITE /SYMB new record
$ go to loop
On the READ command, you may need to try /KEY, /MATCH and /INDEX to read
"around" the RMS file corruption.