Basic DL/I database concepts

This topic deals with DL/I concepts related to database I/O only. DL/I calls are also used in IMS™ to handle terminal and program-to-program communications. See Using non-database PCBs in DL/I programming.

These 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. If a sequence field is defined for the child segment, DL/I stores stores multiple occurrences of the same child segment in sequence field order under that child's 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.
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
Points to the program communication block (PCB) that identifies the database that DL/I is to access on the call.
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® for MVS/ESA™ or CICS for VSE/ESA™ to create the DL/I parameter list. VisualAge® Generator creates DL/I parameter lists for you based on the I/O option and the position of the I/O object in the PSB. 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 SCAN function (DL/I get next function) 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 scanning 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.

Related concepts:
DL/I database support

Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.