Vesselin,
after the 80 bytes header what you have is a record index, a list that is 
NumRecords length.
The first field, LocalID is the offset of the beginning of the respective 
record.
You need to calculate the record lenght (number of bytes to read) subtracting 
the next record start offset, or the file lenght for the last record.
The data in records is not structured, so each record could have different 
lenght and data types.
Is up to your app how you interpret the read buffer.
I have done a program for creating/reading the PDB in VB, but it will only 
works for standard PDBs, and in OS5 an OS6 you have 2 new databases types, 
extended and structured.
At the end I found the best way to create a DB on a PC is doing a hotsync of 
the info from the PC to the PDB in the PDA and a later backup will give you the 
PDB you are looking for.

The oterh two fields in the record index are the record flags and an ID Palm 
uses internally, dont mind about this.
There is a PDF file called FileFormatSpec.pdf with the info you need, if you 
can not find it in Palm'Site, I can send it to you. I have also found somewhere 
the file format for the newer PDBs.

Regards
Oscar

-----Mensaje original-----
De: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] nombre de Dr. Vesselin
Bontchev
Enviado el: Jueves, 31 de Marzo de 2005 12:08
Para: Palm Developer Forum
Asunto: PDB file format


Hello folks,

I want to construct a PDB database on a PC, so I need to understand the file 
format of the PDB files. I've read the documentation provided by PalmSource

http://www.palmos.com/dev/support/docs/protein_books/File_Formats/Intro.html#970019
http://www.palmos.com/dev/support/docs/protein_books/File_Formats/PDBandPRCFormat.html#972428

but when comparing to the actual stuff I see in a PDB file exported from the 
device, some things don't make sense...

OK, I understand that the PDB file has a 80-byte header:

UInt8 name[dmDBNameLength];     // 32 bytes
UInt16 attributes;              //  2 bytes
UInt16 version;                 //  2 bytes
UInt32 creationDate;            //  4 bytes
UInt32 modificationDate;        //  4 bytes
UInt32 lastBackupDate;          //  4 bytes
UInt32 modificationNumber;      //  4 bytes
LocalID appInfoID;              //  4 bytes
LocalID sortInfoID;             //  4 bytes
UInt32 type;                    //  4 bytes
UInt32 creator;                 //  4 bytes
UInt32 uniqueIDSeed;            //  4 bytes
LocalID nextRecordListID;       //  4 bytes
UInt16 numRecords;              //  2 bytes
UInt16 firstEntry;              //  2 bytes

What is supposed to follow is numRecords records, each having the following 
structure:

LocalID localChunkID;           //  4 bytes
UInt8 attributes;               //  1 byte
UInt8 uniqueID[3];              //  3 bytes

with all numbers being stored in big-endian format.

Now, if I examine a real PDB file with a hex editor, the stuff after the 
80-byte header looks like this:

02 D0 40 F3 20 01 00 00
02 F1 40 F3 20 02 00 00
03 04 40 F3 20 03 00 00
03 16 40 F3 20 04 00 00

etc.

OK, "20" is, presumably, the attributes and "01 00 00", etc. are the uniqueIDs. 
But how to interpret the localChunkID part?

According to the PalmOS documentation, the localChunkID is "The local offset 
from the top of the PDB to the start of the raw record data for this entry.". 
But I don't see how one can interpret, say, "02 D0 40 F3" like this.

In fact, in the particular file I'm examining, the first part ("02 D0") *can* 
be interpreted like that - indeed the first data record resides at offset 
0x02D0 from the beginning of the file. But where does "40 F3" come from and 
what is its meaning?

Regards,
Vesselin
-- 
For information on using the Palm Developer Forums, or to unsubscribe, please 
see http://www.palmos.com/dev/support/forums/




-- 
For information on using the Palm Developer Forums, or to unsubscribe, please 
see http://www.palmos.com/dev/support/forums/

Reply via email to