

Record Storage and Deletion › Record Storage
Record Storage
Determining the Target Page
To store a record in the database, CA IDMS/DB first determines a target page. Storage mode specifications govern the selection of the target page, as follows:
- In CALC storage mode, CA IDMS/DB calculates the number of the target page by executing a randomizing routine against the CALC key.
- In VIA or CLUSTERED storage mode, which is used to store related record occurrences (or rows) on the same page or on as few pages as possible, CA IDMS/DB determines the number of the target page from:
- For non-SQL, the number of the page that contains the current record of the VIA set
- For SQL, the referenced row of a clustered constraint
- In DIRECT storage mode, the user explicitly specifies the target page. (Note that if you specify the value -1, the target page is the first page assigned to the record type.)
Storing the Record Occurrence
If the target page has sufficient space to store the entire record occurrence (fixed-length uncompressed records) or the record's minimum root, CA IDMS/DB then stores the record occurrence on the target page. If the target page does not have sufficient free space to store the record occurrence, CA IDMS/DB stores the record occurrence on the next page that has sufficient space. The search for free space always proceeds in a forward (higher database key) direction. If the end of the area (or the page range assigned to the record type) is reached before space is located, the search wraps around to the beginning of the area (or the page range assigned to the record type).
After identifying the first available free page, CA IDMS/DB performs the following operations to store a record occurrence:
- Creates a line index and positions it at the end of the free space or an unused line index.
- Positions the prefix and data (as retrieved from the program variable storage) at the beginning of the free space.
When storing a fixed-length uncompressed record, CA IDMS/DB places the entire record occurrence on the target page. When storing a variable-length record occurrence, CA IDMS/DB places as much of the record occurrence as possible on the target page. (For details, see 36.1.3, “Storing Variable-Length Records”.)
- Updates the space available count in the header and the line space count in the footer.
- Updates the record's pointers as follows:
- Updates the pointers for all user sets in which the record is an automatic member
- Sets the pointers to null (-1) for all sets in which the record is a manual member
- Sets the pointers to the database key of the object record itself for all owner records (indicating an empty set)
- For SQL, sets the pointers to null (-1) for linked constraints in which the table is the referencing table if one or more columns of the foreign key are null; otherwise, sets the pointers to the db-keys of related rows
- For SQL, sets the pointers to the database key of the object row itself for linked constraints in which the table's the referenced table
- Updates the record's CALC set pointers (if any).
- Updates the pointers in all other records affected by the stored record's automatic (and CALC, if applicable) set connections.
For example, if record B2 is being stored between records B1 and B3 in set A-B, B2's next pointer is set to B3's database key, while B2's prior pointer is set to B1's database key. Additionally, B1's next pointer is changed from B3's database key to B2's, and B3's prior pointer is changed from B1's database key to B2's.
Copyright © 2014 CA.
All rights reserved.
 
|
|