An IMS database is a collection of data accommodating physical files. In a hierarchical database, the topmost level contains the general information about the entity. As we proceed from the top level to the bottom levels in the hierarchy, we get more and more information about the entity.
Each level in the hierarchy contains segments. In standard files, it is difficult to implement hierarchies but DL/I supports hierarchies. The following figure depicts the structure of IMS DB.
Points to note −
A segment is created by grouping of similar data together.
It is the smallest unit of information that DL/I transfers to and from an application program during any input-output operation.
A segment can have one or more data fields grouped together.
In the following example, the segment Student has four data fields.
Student | |||
---|---|---|---|
Roll Number | Name | Course | Mobile NUmber |
Points to note−
A field is a single piece of data in a segment. For example, Roll Number, Name, Course, and Mobile Number are single fields in the Student segment.
A segment consists of related fields to collect the information of an entity.
Fields can be used as a key for ordering the segments.
Fields can be used as a qualifier for searching information about a particular segment.
Points to note −
Segment Type is a category of data in a segment.
A DL/I database can have 255 different segment types and 15 levels of hierarchy.
In the following figure, there are three segments namely, Library, Books Information, and Student Information.
Points to note −
A segment occurrence is an individual segment of a particular type containing user data. In the above example, Books Information is one segment type and there can any number of occurrences of it, as it can store the information about any number of books.
Within the IMS Database, there is only one occurrence of each segment type, but there can be an unlimited number of occurrences of each segment type.