Article 168626 of comp.os.vms: In article <5jr3vg$964@gap.cco.caltech.edu>, mathog@seqaxp.bio.caltech.edu wrote: >The saga of the mangled mail files continued. I'm helping to fix up a >system which suffered several months of a 9.0 Gb disk while it was still at >VMS 5.5-2, which doesn't support disks that size. Long story short, this >shot the disk full of holes, many of which unfortunately landed at key >places in mail.mai files. The original poster goes on to ask for a tool, which, among other things, can construct a MAIL.MAI record for an orphaned MAIL$<16hex_digits>.MAI file: >3. (This is the hard part) > Constructs a valid mail.mai record, containing the from, subject, file > index number, and date file was created, and inserts it into mail.mai. Here is the information that I know of. I don't claim that this is exhaustive; in fact, I know it not to be complete. This should help you construct the records for MAIL.MAI: Layout of a MAIL.MAI record Offset Field Length Comments 0 Date-time 8 Primary key for file 8 Folder-name 40 Counted ASCII, fill fields with NUL chars (Count is unsigned in first byte, maximum folder-name length is 39 characters.) 48 Attributes 8 Flag bits Bit 0 is new message Bit 1 is replied-to Bit 2 is unknown Bit 3 is external-file 56 File ident 8 Convert to an ASCII file name according to the following rules: If bits <63-48> .eq. 4 then filename = "MAIL$" + 16 hex digits (MAIL$0004xxxxxxxxxxxx.MAI) The 12 x's are the leftmost 12 hex digits of the time stamp. If bits <63-48> .eq. 5 then reverse the two 32-bit words and convert to MAIL$xxxxxxxx0005xxxx.MAI where the 4 x's following the 5 followed by the 8 x's following the $ are the leftmost 12 hex digits of the time stamp. 64 Variable information Consists of consecutive TLD fields to the end of the record. A TLD field is a 2-byte binary field identifier, followed by a 2-byte binary length, followed by data whose length is the second 2-byte subfield. Zero length is allowed. TLD types: 0 From:-line This contains the nodename-string and username from whom the mail originated, followed by (optionally) whitespace and a quoted string. The quoted string, if present, contains the sender's personal name string and/or the date and time the message was sent. If both fields are present, the personal name is first, and is followed by TWO spaces. The personal name must begin with a letter. If the quoted string begins with a digit, then it is just the time stamp. E.g., NODE1::NODE2::DCANTOR "Dave Cantor 29-Apr-1997 12:34:56 -0400" ^_Sender ^pers name ^date-time sent 1 To:-line 2 Subject:-line 3 CC:-line 4 (unknown) 5 Number of lines in message (as a 32-bit number) (It will appear in DUMP/REC as xxxxxxxx00040005 ; 5 is the TLD type, 4 is the length, xxxxxxxx is the number of lines in the message.) 6 (unknown) 7 (unknown, but appears that: a. It is always present b. It is always of length 20 c. It is the first TLD present d. It's value is 20 NUL characters.) Here's a dump of a typical record (which was extracted with SEARCH/FORMAT=PASSALL), with some obliteration of original contents, and some commentary: Record number 14 (0000000E), 193 (00C1) bytes, RFA(0005,0000,01A2) 524F5754 50555308 009AE61D 9D9EA160 `¡...æ...SUPTWOR 000000 8-char folder 00000000 00000000 00000000 0000004B K............... 000010 named "SUPTWORK" 00000000 00000000 00000000 00000000 ................ 000020 0005009A E61D9D9E 00000000 00000008 ...........æ.... 000030 external file MAIL$E61D9D9E0005009A.MAI 00000000 00000000 00000000 00140007 ................ 000040 TLD 7 41424242 00140000 00000000 00000000 ............BBBA 000050 From: BBBARD::USER01 20202020 20203130 52455355 3A3A4452 RD::USER01 000060 5055533A 53595324 53424940 00150001 ....@IBS$SYS:SUP 000070 To: @IBS$SYS:SUPTWORK.DIS 58585800 2C000253 49442E4B 524F5754 TWORK.DIS..,.XXX 000080 2C736D65 6C626F72 70205858 58585858 XXXXXX problems, 000090 Subj: (begins with "XXXXXXXXX", ends with "deals") 7263206E 65747469 72772D66 6C616820 half-written cr 0000A0 00004800 04000573 6C616564 2073736F oss deals....H.. 0000B0 72 lines in msg. 00 ................ 0000C0 I hope this helps. Dave Cantor -- David A. Cantor +1 617-664-0243 State Street Bank, Boston, Mass. ^NEW^ I speak for myself only; not for my employer. Personal e-mail to DCantor@shore.net