[Info-vax] Recovering messages from a MAIL.MAI file?

Hein RMS van den Heuvel heinvandenheuvel at gmail.com
Tue Feb 6 11:42:30 EST 2018


Area sizes and such are the least of your worries, 
Here is a trivial, but sufficient, FDL which will be good enough for recovery:
------------
FILE; ORGANIZATION indexed
RECORD; SIZE 2048
KEY 0; TYPE bin8
KEY 1; CHANGES yes; DUPLICATES yes; NULL_KEY yes; SEG0_L 39; SEG0_P 9
-------------
That's all.... but you do NOT have the proper source records to be converted.

>>  I can use set file/attr  to set RFM:VAR. ORG:IDX, MRS:2048, RAT:NONE and BKS:5.  But I see no way to set the prolog definition. 

'A little knowledge is a dangerous thing' 

Setting those attributes is a silly, useless operation.
It is NOT an indexed file, it is just a stream of mangled record data from an indexed file.

When the MAIL.MAI file was zipped up, only the raw bytes from the data records were read, nothing of the indexed file structured-ness was seen.
The good news it that all the bits are there.
The bad news it that any information on the individual record size/end is lost.
When the file is unzipped it is created as a stream-lf file, turning any accidental binary 0x0A (line-feed) into a record terminator. They are not!
Best you can do is to SET FILE/ATTR=(rfm=fix,lrl=512,mrs=512), read it BINARY, and go hunt for patterns. The patterns are not too hard.
Each Email has two records. 

First with message content (if (well) less than 2KB). 
Primary = timestamp, Alternate=nulls 
For example today: "000500B2 82C0724B"
After the zone of zeroes for the Alternate key start the message lines.
Each 'line' is preceded with length word, 
That's how to know where the next line, or the next record starts.
line-length > 200, is your first indication you maigh be looking at a next record.

Second record for each message has the: to, from, subject as TLV's. 
Easy parse!
Primary is re-hash (16 bit shift) of the timestamp.
Alternate key is the FOLDER name. For the example above: 00B282C0 724B0000

IF you truly want to record this zipped Email, then you need to write or find a program which applies the above knowledge to split the unzipped file into records, which you can convert after that, or just print out as text ?!?

I think I have a program for that floating around somewhere... 
What's it worth to you? :-) :-)

Below some 'proof'

Cheers,
Hein

DUMP/BLOCK for UNZIPPED
- see that 0A at byte 0x48, that will turn into a record end when (erroroneously) treated as stream-lf file, but it really is just the length of the message line "CCCCCCCCCC"
- see that "000500B2 82C08186" at 0x54? That the beginning of record #2.
- "00B282C0 724B0000" at byte 0x94? STart of the 3rd record.
- "000C0000" at 0xEC? - Tag 0, lenght 12, "from: SYSTEM      "
- "00060001" at 0xFC? - tag 1, length 6, "to: SYSTEM"
- "000B 0002" at 0x10A? - Tag 2, length 11, "subject: Hello World"

 00000000 00000000 000500B2 82C0724B KrÀ.²........... 000000
 00000000 00000000 00000000 00000000 ................ 000010
 00000000 00000000 00000000 00000000 ................ 000020
 42424200 0B414141 41414141 41410009 ..AAAAAAAAA..BBB 000030
 43434343 4343000A 42424242 42424242 BBBBBBBB..CCCCCC 000040
 00000000 000500B2 82C08186 43434343 CCCC..À.²....... 000050
 00000000 00000000 00000000 00000000 ................ 000060
 00000000 00000000 00000000 00000000 ................ 000070
 2068616C 62206861 6C62000E 00000000 ......blah blah  000080
 57454E07 00B282C0 724B0000 68616C62 blah..KrÀ.²..NEW 000090
 00000000 00000000 00000000 4C49414D MAIL............ 0000A0
 00000000 00000000 00000000 00000000 ................ 0000B0
 82C0724B 00000000 00000001 00000000 ............KrÀ. 0000C0
 00000000 00000000 00140007 000500B2 ²............... 0000D0
 000C0000 00000000 00000000 00000000 ................ 0000E0
 00060001 20202020 20204D45 54535953 SYSTEM      .... 0000F0
 6568000B 00020000 00034D45 54535953 SYSTEM........he 000100
 00000300 04000564 6C726F77 206F6C6C llo world....... 000110
 49414D57 454E0700 B282C081 86000000 .....À.²..NEWMAI 000120

DUMP/RECORD for original for this:

Record number 1 (00000001), 84 (0054) bytes, RFA(0004,0000,0002)

 00000000 00000000 000500B2 82C0724B KrÀ.²........... 000000
 00000000 00000000 00000000 00000000 ................ 000010
 00000000 00000000 00000000 00000000 ................ 000020
 42424200 0B414141 41414141 41410009 ..AAAAAAAAA..BBB 000030
 43434343 4343000A 42424242 42424242 BBBBBBBB..CCCCCC 000040
                            43434343 CCCC............ 000050

Record number 2 (00000002), 64 (0040) bytes, RFA(0004,0000,0004)

 00000000 00000000 000500B2 82C08186 ..À.²........... 000000
 00000000 00000000 00000000 00000000 ................ 000010
 00000000 00000000 00000000 00000000 ................ 000020
 68616C62 2068616C 62206861 6C62000E ..blah blah blah 000030

Record number 3 (00000003), 141 (008D) bytes, RFA(0004,0000,0001)

 4C49414D 57454E07 00B282C0 724B0000 ..KrÀ.²..NEWMAIL 000000
 00000000 00000000 00000000 00000000 ................ 000010
 00000000 00000000 00000000 00000000 ................ 000020
 000500B2 82C0724B 00000000 00000001 ........KrÀ.²... 000030
 00000000 00000000 00000000 00140007 ................ 000040
 54535953 000C0000 00000000 00000000 ............SYST 000050
 54535953 00060001 20202020 20204D45 EM      ....SYST 000060
 206F6C6C 6568000B 00020000 00034D45 EM........hello  000070
       00 00000300 04000564 6C726F77 world........... 000080

Record number 4 (00000004), 136 (0088) bytes, RFA(0004,0000,0003)

 4C49414D 57454E07 00B282C0 81860000 ....À.²..NEWMAIL 000000







More information about the Info-vax mailing list