This chapter describes the format of Palm OS® record (PDB) and resource (PRC) databases. Palm™ record databases contain records that are used with applications that run on Palm Powered™ handhelds. Palm resource databases contain application resources, including the code and the user interface objects for the application.
These databases are stored in memory on handheld devices, and are stored in file form on desktop computers. This chapter describes the file format of these databases, which is slightly different than their in-memory format. The in-memory format is subject to change and is not documented by PalmSource, Inc.
This chapter contains the following sections:
- "Overview of PDB and PRC Databases" provides an overview of the database representation and shows an image of that representation.
- "Record and Resource Entries" describes the entries that provide information about each record or resource in a database.
- "The Application Information Block" describes the application information block that can optionally be included in PDB and PRC databases.
- "The Sort Information Block" describes the sorting information block that can optionally be included in PDB and PRC databases.
- "PDB and PRC Raw Data" describes how the raw record data is stored in PDB and PRC databases.
- "Reading and Writing PDB and PRC Data" describes the Palm OS functions that you can use to convert a chunk of data to a Palm database, or convert a Palm database to a chunk of data.
For an overview of Palm databases and file formats, including a detailed description of the database header format, see Chapter 1, "Introduction to File Formats."
NOTE: This chapter describes the format of PDB and PRC databases that are stored in files on desktop computers. When one of these databases is loaded into a Palm Powered handheld, the database is stored in memory in a format that is similar to, but different than the format described here. The in-memory format of PDBs and PRCs is subject to change and is not documented by PalmSource, Inc.
Overview of PDB and PRC Databases
Each PDB and PRC database contains the following components:
- A header containing fields that describe the database and refer to the information blocks and raw record data in the database. The Palm Database header is described in "The Palm Database Header."
- A list of record entries, each of which describes a block of raw record or resource data.
- Two optional information blocks: the application information block and the sort information block.
- The raw record data, which is stored in linear format and referenced from the record list in the header.
Figure 2.1 shows the structure of a Palm database, as stored in a file on a desktop computer.
Figure 2.1 PDB and PRC database format

Record and Resource Entries
The record list in the Palm database header contains a list of entries that describe the raw data records or resources in the database. The record list is described in "The Record List." The entries in PDB and PRC databases have different structures, and are described separately in this section.
PDB Record Entries
The following structure declaration represents a record entry in a PDB file:
Prototype
typedef struct { LocalID localChunkID; UInt8 attributes; UInt8 uniqueID[3]; } RecordEntryType;
Fields
-
localChunkID
- The local offset from the top of the PDB to the start of the raw record data for this entry.
- Note that you can determine the size of each chunk of raw record data by subtracting the starting offset of the chunk from the starting offset of the following chunk. If the chunk is the last chunk, its end is determined by the end of the file.
-
attributes
- Attributes of the record.
-
uniqueID
- A three-byte long unique ID for the record.
PRC Resource Entry Fields
The following structure declaration represents a resource entry in a PRC file:
Prototype
typedef struct { UInt32 type; UInt16 id; LocalID localChunkID; } RsrcEntryType;
Fields
-
type
- The resource type.
-
id
- The ID of the resource.
-
localChunkID
- The local offset from the top of the PRC to the start of the resource data for this entry.
- Note that you can determine the size of each chunk of raw resource data by subtracting the starting offset of the chunk from the starting offset of the following chunk. If the chunk is the last chunk, its end is determined by the end of the file.
The Application Information Block
Each Palm Database can optionally include an application information (appInfo
) block that contains arbitrary information.
The format of the appInfo
block is determined by the creator of the database. However, PDBs that support the standard Palm OS category data, the appInfo
block contains specific information, as described in "Finding the Length of the Application Information Block," below.
Finding the Length of the Application Information Block
If the database includes an application information block, you can find its length by finding the block that follows it:
- If the database includes a sort information block, that block immediately follows the application information block.
- If the database does not include a sort information block, but does include one or more records, then the end of the application information block is just before the start of the first record block.
- If the database does not contain a sort information block and does not contain any records, then the end of the application information block is the end of the file.
Standard Category Data in an Application Information Block
A PDB for an application that supports standard Palm OS category data includes the category data in the standard format shown in Figure 2.2.
Figure 2.2 PDB appInfo bock for standard category data

The following structure declaration represents an application information block for an application that uses standard Palm OS category information:
Prototype
typedef struct { UInt16 renamedCategories; Char categoryLabels[16][16]; UInt8 categoryUniqIDs[16]; UInt8 lastUniqID; UInt8 padding; } AppInfoType;
Fields
-
renamedCategories
- Specifies which categories have been renamed.
-
categoryLabel
- An array of 16 null-terminated category labels, each of which is 16 bytes long.
-
categoryUniqID
- An array of 16 category ID values, each of which is one byte long.
-
lastUniqID
- The last unique category ID assigned.
-
padding
- Unused.
The Sort Information Block
The structure of the optional sortInfo
block is completely up to the application; there is no standard format, nor is there a structure declared for this block. Most PDBs that contain a sortInfo
block use it to store ordering information based on record IDs.
Finding the Length of the Sort Information Block
If the database includes a sort information block, you can find its length by finding the block that follows it:
- If the database includes one or more records, then the end of the sort information block is just before the start of the first record block.
- If the database does not contain any records, then the end of the sort information block is the end of the file.
PDB and PRC Raw Data
Record data in a PDB is stored as a block of contiguous records. The local offset to the beginning of each record is stored in the record list(s) in the database header. The length and format of the record data is application-specific.
Similarly, resource data in a PRC database is stored as a block of contiguous resources. The local offset to the beginning of each resource is stored in the record list(s) in the database header. The length and format of the resource data is not documented in this book.
Reading and Writing PDB and PRC Data
The Palm OS provides functions that you can use to convert data into or out of Palm Database formats:
- If you have a chunk of data on the handheld device that is formatted as described in this chapter, you can use either the
DmCreateDatabaseFromImage()
function or theExgDBRead()
function to convert that data into a Palm Database. - If you want to convert a Palm Database into a chunk of data on the handheld device, you can use the
ExgDBWrite()
function.