IMS DB DL/I Control Blocks

DL/I Control Blocks Structure -

DL/I Control Blocks

DL/I Control Blocks are essential structures that define how data is organized, accessed, and manipulated. They act as blueprints and access guides for both the database and the application programs interacting with it. The three primary control blocks are:

  • DBD (Database Descriptor)
  • PSB (Program Specification Block)
  • ACB (Access Control Block)

DBD – Database Descriptor -

The DBD outlines the physical structure of the database. It defines the hierarchy of segments, their relationships, and storage details.

Example: Consider a company database:

  • Company (Root Segment)
    • Project (Child of Company)
      • Employee (Child of Project)

The DBD would specify this hierarchy, detailing how each segment is connected and stored.

DBDGEN -

DBDGEN is a Database Descriptor Generator. It is the responsibility of the Database Administrator to create control blocks. All load modules are stored in the IMS library. Macro statements are utilized to create these control blocks. Below is a sample code that demonstrates how to create a DBD using DBDGEN control statements -

PRINT	NOGEN
DBD	NAME=COMPANY,ACCESS=HIDAM
DATASET	DD1=COMP,DEVICE=3380
SEGM	NAME=COMPSEG,PARENT=0,BYTES=10
FIELD	NAME=(COMPANY,SEQ,U),BYTES=10,START=1,TYPE=C
SEGM	NAME=PROJSEG,PARENT=COMPSEG,BYTES=5
FIELD	NAME=(PROJ_ID,SEQ,U),BYTES=10,START=1,TYPE=C
SEGM	NAME=EMPLSEG,PARENT=COMPSEG,BYTES=9
FIELD	NAME=(EMPL_ID,SEQ),BYTES=8,START=1,TYPE=C
DBDGEN
FINISH
END

Let us explain the terms used in the DBDGEN: When you execute the control statements in JCL, they create a physical structure where "COMPANY" is the root segment, and "PROJECTS" and "EMPLOYEE" are its child segments.

The following table shows parameters used in FIELD macro statement −

ParameterDescription
NameName of the field, typically 1 to 8 characters long
BytesLength of the field
StartPosition of field within segment
TypeData type of the field
Type CCharacter data type
Type FFull word binary data type
Type HHalf word binary data type
Type PPacked decimal data type
Type XHexadecimal data type
Type ZZoned decimal data type

PSB – Program Specification Block -

The PSB defines the logical view of the database for an application program. It specifies which parts of the database the program can access and what operations it can perform.

Example: An HR application might have a PSB that allows:

  • Read access to Company and Project segments.
  • Read/Write access to Employee segments.

PSBGEN -

PSBGEN stands for Program Specification Block Generator. The following example demonstrates how to create a PSB using PSBGEN -

PRINT	NOGEN
PCB     TYPE=DB,DBDNAME=COMPANY,KEYLEN=10,PROCOPT=LS
SEGM	NAME=COMPSEG
SEGM	NAME=PROJSEG,PARENT=COMPSEG
SEGM	NAME=EMPLSEG,PARENT=COMPSEG
PSBGEN  PSBNAME=COMPPSB,LANG=COBOL
END

ACB – Access Control Block -

The ACB is a compiled combination of the DBD and PSB. It serves as the runtime control block, providing the application program with the necessary information to access the database as defined.

ACBGEN stands for Access Control Blocks Generator, and it is utilized to generate Access Control Blocks (ACBs). For online programs, ACBs must be pre-built, so the ACBGEN utility is executed prior to running the application program. In contrast, for batch programs, ACBs can be generated during execution as well.

Example: Before the HR application runs, the system generates an ACB that combines the database structure (from the DBD) and the program's access permissions (from the PSB). This ACB is then used during the application's execution to guide data access.

How They Work Together -

When an application program needs to interact with the IMS database:

  • It references the ACB, which provides the combined view of the database structure and access permissions.​
  • The ACB utilizes information from the DBD to understand the physical layout of the data.​
  • It also uses the PSB to determine what operations the application is permitted to perform.