DL/I data

IBM® developed DL/I (Data Language/One) in the 1960s as a hierarchical database management system. DL/I remains a widely used database system in COBOL programs today.

The following terms and concepts are essential in developing a DL/I database program:
Segments
The primary unit of data in a DL/I database is the segment. A segment is similar to a record. It is a single block of data divided into data fields.
Database Hierarchy
A single database can contain many types of segments. These segments are arranged in a hierarchical (top down) relationship. The segment at the top of the hierarchy is called a root segment. Each segment can have one or more dependent segments related to it at a lower level in the hierarchy. A segment with a dependent segment is called the parent of the dependent segment. The dependent segment is called a child segment. Each segment in the database, except for a root segment, has one and only one parent. The root segment has no parent.
Sequence Field
Each segment type in a database can have one of its fields designated as a sequence field. The value of the sequence field determines the order in which the segments are stored and retrieved from the database. When a parent segment has multiple occurrences of the same child segment type and a sequence field is defined for the child segment, DL/I stores those child segments in sequence field order under that parent.
Program Specification Block (PSB)
A PSB is a formal DL/I description of the hierarchical database structures that a program can access. The EGL record part of type PSBRecord contains the information that your program needs to interact with the DL/I PSB. The PSB shows the hierarchical relationships that exist between types of segments. For more information, see Data access using PSBs and PCBs in the EGL Language Reference.
Program Communication Block (PCB)
A PCB is an entry in a PSB. Each database PCB describes one hierarchical data structure that a program can use. The data structure might correspond directly to the structure of a physical or logical DL/I database or might invert the database structure through access by a secondary index.
DL/I call
A DL/I call is an invocation of DL/I by a program. The parameter list passed for a database call provides DL/I with the following information:
Function code
Indicates if DL/I is to get, insert, replace, or delete segments from the database.
Database identifier
For DL/I calls using CBLTDLI, points to the program communication block (PCB) that identifies the database that DL/I is to access on the call. For DL/I calls using AIBTDLI, provides the name of the PCB in the PSB.
I/O area address
Identifies the address of the buffer that contains the segment after it is read from the database or before it is written to the database.
Segment search argument (SSA) list
Lists a set of search criteria that enables DL/I to select the segments that it retrieves from the database or specify the position of segments it inserts into the database.
When you code a DL/I program in a language like COBOL or PL/I, you either code the DL/I parameter list directly or use the command level interface of CICS® to create the DL/I parameter list. EGL creates DL/I parameter lists for you based on the I/O statement and the position of the DL/I segment in the PCB.. You can view the DL/I call created for the function. You can also modify the DL/I call to use additional DL/I functions.
Database position
When a program is running, DL/I maintains a position pointer for each PCB in the program PSB. The pointer indicates the place in the database where a get next statement begins searching for the segment to retrieve.

The position pointer is set on any successful DL/I call to point to the segment following the last segment accessed on the call. If no calls are issued, the current position indicates the start of the database. If the end of database condition is encountered, the current position becomes the start of the database.

As DL/I continues searching a database for a segment that satisfies the SSA list criteria, DL/I accesses each root segment in the order it appears in the database. When DL/I finds a root segment, it accesses all the dependents of the root before scanning the next root. As DL/I scans the dependent segments, it first tries to read the next segment at the next lower level. If there is not a lower level, it reads the next segment at the same level. If there are no more segments at the current level, it returns to the previous level to search for the next segment. This process is called the “top to bottom, left to right” search order.

You can write EGL programs that access DL/I databases by using many of the same EGL statements you would use to access a relational database: add, delete, get, and replace. When your EGL statement specifies a record variable based on the DLISegment stereotype, EGL knows to generate code that works with a DL/I database.

As with SQL, you can write DL/I programs entirely in EGL, or you can specify explicit DL/I code to get more control of the details. In this case you write DL/I pseudocode, and EGL translates it into actual DL/I commands.

For a diagram of an example DL/I database layout, see Example DL/I database. For sample solutions to common DL/I coding problems, see DL/I examples.


Feedback