Identify Each Record Occurrence
Each record occurrence in a CA IDMS database is uniquely identified by a database key (db-key), which indicates the occurrence's physical location in the database. A db-key is assigned when a record occurrence is stored in the database. The db-key never changes as long as the record remains in the database (that is, until the record is erased or until the database is unloaded and subsequently reloaded).
Used as Pointers
Database keys are used as pointers to related record occurrences or index records. As such, database keys are found in the system-maintained prefixes that precede the data portion of the record occurrence. For example, a record occurrence's prefix may contain the database keys of the next, prior, and owner records of the chained set in which that occurrence is a member.
A db-key is a 4-byte (32 bit) binary number. The Database Management System (DBMS) creates a db-key for a record occurrence by concatenating the following numbers:
Db-key Format
The db-key format is variable. The number of bits reserved in the db-key for the page number and line number, respectively, can vary from one physical database to another, as long as the total number of bits used is 32. You identify the db-key format to be used by specifying the maximum number of record occurrences to be stored on one database page in the CREATE SEGMENT statement.
Default Db-Key Format
In the default db-key format, 24 bits are allocated for the page number and eight bits for the line number. This format allows a maximum of 16,777,214 pages in the database, with each page containing up to 255 record occurrences.
Variable Format
The variable format of the db-key allows you to tailor space management factors to different processing requirements. For storage of small records, specify a database with many record occurrences per page and a smaller number of pages. For storage of large records, specify a database with few record occurrences per page but a large number of pages. For these different requirements, adjust the db-key format as follows:
As the number of record occurrences allowed on a page increases, the number of pages allowed in the database decreases. Conversely, the more pages in the database, the fewer occurrences each page can hold.
Note: The MIXED PAGE GROUP BINDS ALLOWED option for a DBNAME may be used to increase the number of records accessible in a database from a single database transaction.
The following diagram shows the db-key formats for n CA IDMS database with three possible formats: 255 record occurrences per page (the default size); the greatest possible number of occurrences per page; and the greatest possible number of pages.

Determining the Db-Key Format
Using the decimal value that you specify in the MAXIMUM RECORDS PER PAGE clause on the CREATE SEGMENT statement, CA IDMS/DB determines the db-key format, as follows:
For example, the default number of record occurrences per page is 255. In this case, the total number of line indexes is 256 (that is, line index 0 through 255). Since the decimal number 255 takes eight bits of storage in binary format, the line number portion of the db-key for this database is eight bits, and the page number portion is 24 bits.
Note: CA IDMS uses all 32 bits of the db-key for the page number and the line number. If you want to reserve a bit in the db-key as a sign bit (that is, if you will write routines that perform arithmetic operations using the db-key sign bit), make sure that the db-keys created for your occurrences can be stored in only 31 bits.
Conversion Algorithms
Use the following algorithms to convert a db-key into individual page and line numbers:
dbkey-page = dbkey/2**bits-for-line dbkey-line = dbkey - (dbkey-page * (2**bits-for-line))
where:
|
Copyright © 2014 CA.
All rights reserved.
|
|