IMS DB Organizations
Database organization refers to how the data is physically stored and structured on the disk. IMS uses a hierarchical database model, but within this model, different physical organizations exist to improve data storage and retrieval based on use cases.
Each organization defines:
- The way data is arranged in storage.
- How records are accessed or updated.
- Performance characteristics based on access patterns.
Example (Banking System):
Bank (Root)
├── Customer (Child 1)
│ ├── Account (Child 1.1)
│ └── Loan (Child 1.2)
└── Branch (Child 2)
- Bank is the root segment.
- Customer and Branch are child segments under Bank.
- Account and Loan are child segments under Customer.
IMS DB Access methods -
IMS DB supports different physical storage methods, called access methods, which determine how data is stored and retrieved.
Sequential Processing -
HSAM (Hierarchical Sequential Access Method) -
- Structure: All data is stored sequentially on disk.
- Data Access: Best for applications that process all data in sequential order.
- Usage: Reporting or batch processing where you read every record.
- Limitations:
- No random access (must read sequentially).
- Cannot update records in place (requires full rewrite).
HISAM (Hierarchical Indexed Sequential Access Method) -
- Structure: Root segments stored in sequential order, with an index to find them quickly.
- Data Access: Suitable for both sequential and indexed access.
- Usage: Ideal for applications requiring sorted data access (e.g., processing all customers in name order).
- Limitations:
- Slower than HDAM for direct access.
- Requires index maintenance.
Random Processing -
HDAM (Hierarchical Direct Access Method) -
- Structure: No index. Instead, it uses a randomizer function to compute the storage location of the root segment.
- Data Access: Fast access to root segments using the computed address.
- Usage: High-volume random access applications where performance is critical.
- Limitations:
- Extremely fast for random access.
- Good for frequently updated data.
Example: It’s like using a formula to predict which drawer a file is in, rather than using an index.
HIDAM (Hierarchical Indexed Direct Access Method) -
- Structure: Uses a separate index database to locate the root segment.
- Data Access: Fast for searching specific root keys using the index.
- Usage: Best when you frequently search for specific root keys (e.g., customer ID).
- Limitations:
- Faster than HISAM for direct lookups.
- Supports sequential scans via indexes.
Example: Imagine a phone book. The index helps you directly jump to the person’s name instead of reading every page.