IMS DB Hierarchical Database Structure
Hierarchical database structure is similar to tree structure. It follows inverted tree structure.
IMSDB Structure Diagram -

In IMS DB, data is organized in a hierarchical structure, much like an inverted tree. This means there's a single top-level segment (the root), and all other segments branch out from it in parent-child relationships. Each child segment is directly dependent on its parent, creating a clear and organized data flow.
IMSDB Structure Example: Imagine a company's organizational chart. At the top is the CEO (root segment), under whom are department heads (child segments), and under them are team members (further child segments).

Database Record
A Database Record consists of a root segment and all its dependent segments. It represents a complete set of related data within the database.
Example: A Company segment along with its associated Project and Employee segments form a single database record.
Segments: Building Blocks of the Hierarchy
A segment is the smallest unit of data that an application can retrieve from the database. Each segment contains one or more fields, which hold the actual data values. Segments are organized hierarchically, with each level representing a different segment type.
Example: In a customer database:
- Company Segment: Contains fields like Company Code.
- Project Segment: Child of Company, with fields like Project Code.
- Employee Segment: Child of Project, with fields like Employee Number and Name.
Fields: The Data Elements
Fields are the individual data elements within a segment. They store specific pieces of information and can be used as keys to search and order segments.
Example: In the Employee Segment, fields might include:
- Employee Number: Unique identifier for the employee.
- Employee Name: Name of the employee.
Parent-Child Relationships
In IMS DB, each segment (except the root) has a single parent segment. This parent-child relationship defines the path through which data is accessed and maintained.
Example: Continuing with our company structure:
- Company Segment (Parent)
- Project Segment (Child)
- Employee Segment (Child)
- Project Segment (Child)
To access an employee's data, you navigate through the company and project segments.
Navigating the Hierarchy
Accessing data in a hierarchical database involves traversing the tree structure from the root to the desired segment. This path-based access ensures data integrity and reflects real-world relationships.
Example: To find all employees in a specific project:
- Locate the Company Segment using the Company Code.
- Traverse to the associated Project Segment using the Project Code.
- Access the related Employee Segments under that project.