PalmOS keeps all RAM storage in a database format. There is no file system in the RAM. When sync'd to a PC these databases will be saved in separate files and this is where the extension is added. All files in device RAM must be in Palm Database format, whether programs or data. The PDB files created for external storage are data files, which can contain arbitrary content.
 Intro to the Database format
The first record of the database contains attribute information about the database, including the Creator ID, Type, Date Created, Date Modified, Launchable, database (book) name, and other data. Palm database files will generally have a .pdb extension but in some cases they may have a .prc extension (see PRC). The extension doesn't really matter on the Palm device so long as it is one of these two. The launcher will look inside the file to determine its type.
PalmOS programs are expected to have a unique four character "Creator" ID. All data files used by a program will have the same Creator ID as the program that uses them. PalmOS uses the Creator ID to know what data files are used by a program, and what program is used to open any particular data file.
 Intro to PalmDOC
The default text file format on Palm devices is the PalmDOC file. This format was originally used by Aportis for their Aportis Reader product. It starts as a plain ASCII text file and is converted using a form of RLE compression to save space in RAM. Available doc readers decompress the file on the fly as they display it. The compression method is "asynchronous" -- it can be decompressed much faster than it can be compressed. Most doc files are created on desktops and synced to the target device, as compressing on the Palm is slow. RLE compression results in an approximate 40% reduction in file size.
Aportis went out of business years ago, and the Aportis Reader is no longer available, but the DOC format was reverse engineered and many reader products can view it. Even reader applications with their own private format can generally also read this format. PalmDOC files have a Creator ID of REAd and a Type of TEXt. TealDoc also has a Type of TEXt and it is identical with PalmDOC.
 Intro to zTXT
A newer plain text format for PalmOS is the zTXT file. zTXT files also start as plain ASCII text files, but are then compressed with gzip compatible compression, for an average reduction of 70%. Decompressing the files requires sysZlib.prc, a port of the Zlib library, implemented as a PalmOS shared library. sysZlib is currently used by the LionDoc, Palm Fiction, Plucker, and WeaselReader document viewers.
If the PDB file has the Launchable attribute set, an icon for the file will appear in the launcher. The icon will be that of the program with the Creator ID of the PDB file. If the Creator app supports the PalmOS sysAppLaunchCmdOpenDB function, the user can tap on the document icon and invoke the owning program to view/edit the file, similar to the Way windows shortcuts work. Not all programs support this usage, so experimentation is needed to see if it will work.
 Palm Database File Code
A table showing the decode of the various Palm database formats. Note that are are more database formats but the table is the ones likely to be encountered by users dealing with eBooks. The first 4 characters identify the type of database and the second four characters identify the program that uses this database.
|DB (Database program)||DB99DBOS|
You can usually use a standard text editor to view the file even though it is a binary image. The file type will show up as clear text on the first line. The internal title for the book is also visible on the first line. Be careful not to modify the file when viewing it in this fashion.
 Palm Database Format
A Palm Database is not a file when stored on the Palm in RAM. However it will be stored as a file if it is synced to a computer. The name of that file will always be the database name. Multi-byte numerical fields are stored in big-endian order, with the most significant byte first. The file will have the following content:
|0||32||name||database name. This name is 0 terminated in the field and will be used as the file name on a computer. For eBooks this usually contains the title and may have the author depending on the length available.|
0x0004 Dirty AppInfoArea
0x0008 Backup this database (i.e. no conduit exists)
0x0010 (16 decimal) Okay to install newer over existing copy, if present on PalmPilot
0x0020 (32 decimal) Force the PalmPilot to reset after this database is installed
0x0040 (64 decimal) Don't allow copy of file to be beamed to other Pilot.
|36||4||creation date||No. of seconds since start of January 1, 1904.|
|40||4||modification date||No. of seconds since start of January 1, 1904.|
|44||4||last backup date||No. of seconds since start of January 1, 1904.|
|52||4||appInfoID||offset to start of Application Info (if present) or null|
|56||4||sortInfoID||offset to start of Sort Info (if present) or null|
|60||4||type||See above table. (For Applications this data will be 'appl')|
|64||4||creator||See above table. This program will be launched if the file is tapped|
|68||4||uniqueIDseed||used internally to identify record|
|72||4||nextRecordListID||Only used when in-memory on Palm OS. Always set to zero in stored files.|
|76||2||number of Records||number of records in the file - N|
|78||8N||record Info List|
|start of record info entry||Repeat N times to end of record info entry|
|4||record Data Offset||the offset of record n from the start of the PDB of this record|
|1||record Attributes||bit field. The least significant four bits are used to represent the category values. These are the categories used to split the databases for viewing on the screen. A few of the 16 categories are pre-defined but the user can add their own. There is an undefined category for use if the user or programmer hasn't set this.
0x10 (16 decimal) Secret record bit.
0x20 (32 decimal) Record in use (busy bit).
0x40 (64 decimal) Dirty record bit.
0x80 (128, unsigned decimal) Delete record on next HotSync.
|3||UniqueID||The unique ID for this record. Often just a sequential count from 0|
|end of record info entry|
|2?||Gap to data||traditionally 2 zero bytes to Info or raw data|
|?||Records||The actual data in the file. AppInfoArea (if present), SortInfoArea (if present) and then records sequentially|
 PDB Times
The original PDB format used times counting in seconds from 1st January, 1904. This is the base time used by the original Mac OS, and there were close links between Palm OS and Mac OS. Using an unsigned 32-bit integer this will overflow sometime in 2040.
However, the PDB tool written for Perl says that the time should be counted from 1st January 1970 (the Unix base time), and uses a signed 32-bit integer which will overflow sometime in 2038.
This conflict is unfortunate, but there's a simple way to sort out what's been done in a file you are examining.
- If the time has the top bit set, it's an unsigned 32-bit number counting from 1st Jan 1904
- If the time has the top bit clear, it's a signed 32-bit number counting from 1st Jan 1970.
This can be stated this with some confidence, as otherwise the time would be before 1972 or before 1970, depending on the interpretation and the PDB format wasn't around then.
For either system, overflow will occur in around 30 years time. Hopefully by then everyone will be on some properly documented eBook standard.