DBD


Uses to defines the layout of the database. Database administrator defines layout using DBDGEN macro. The DBD contains the name of the database and defines the whole database actual structure. The below information is needed by application programmer to create the database

  • Database name
  • Segment names
  • Key field names, lengths and locations
  • Search field names, lengths and locations

The DBD contains the IMS and MVS access methods and defines how many datasets and DD statements are required. The DDNAMES for the database are also found in the DBDs.

DBDs are assembled (DBDGEN) and reside in DBDLIBs. DBDs and PSBs are generated by the database administration team and not by application programmers or users.

Users do not need to know how to create DBDs, PSBs, or PCBs in order to use the interface to IMS-DL/I. IMS databases are defined in a Data Base Definition (DBD).

DBDs contain information as the segment types, their place in the hierarchy and the segment keys if any. The Database Description (DBD) is usually created by the DBA at an installation. The DBD specifies characteristics of a database, including

  • The name of the DBD is also used as a shorthand name for the IMS-DL/I database (1-8 characters).
  • The type and access method for the database (DEDB, MSDB, HDAM, HIDAM, HSAM, HISAM, GSAM, SHISAM, or SHSAM).
  • The random method to assign an address to each record's key (HDAM only).
  • The Ddname for the database.
  • The device type.
  • The block size.
  • The name, parent, and length of each segment type in the database.
  • The parent information enables IMS-DL/I to determine the segment's position in the hierarchy.
  • The name, length, starting position and type of data for each sequence and search field in each segment.
Note!
  • It is not necessary to specify every field in a segment in the DBD.
  • Only sequence and search fields are specified in the DBD.

How to create DBD?


As explained above, DBA is responsible to create Database. Tree structure for the above DBD will be like below.

DataBase Description (DBD)

The below is the sample DBD for the simple company structure.

DBD	NAME=COMPNYDB,ACCESS=HDAM
	DATASET	DD1=CMPN,DEVICE=3380
	SEGM	NAME=COMPANY,PARENT=0,BYTES=10
	FIELD	NAME=(CMPNCODE,SEQ,U),BYTES=10,START=1,TYPE=C
	SEGM  	NAME=PROJECT,PARENT=COMPANY,BYTES=5
	FIELD	NAME=(PROJCODE,SEQ,U),BYTES=5,START=1,TYPE=C
	SEGM  	NAME=BENCH,PARENT=COMPANY,BYTES=11
	FIELD	NAME=(BNCHCODE,SEQ,U),BYTES=11,START=1,TYPE=C
	SEGM  	NAME=PROJEMPL,PARENT=PROJECT,BYTES=15
	FIELD	NAME=(PEMPID,SEQ,U),BYTES=4,START=1,TYPE=C
	FIELD	NAME=(PEMPNAME,SEQ,U),BYTES=11,START=1,TYPE=C
	SEGM  	NAME=BNCHEMPL,PARENT=BENCH,BYTES=15
	FIELD	NAME=(BEMPID,SEQ,U),BYTES=4,START=1,TYPE=C
	FIELD	NAME=(BEMPNAME,SEQ,U),BYTES=11,START=1,TYPE=C
	DBDGEN
	END 

The DBD definition contains the following statements:

DATASET

Used to define Ddname and block size for the data set. One DATASET statement is sufficient for each data set group.

SEGM

Used to define segment type, segment position in the hierarchy, segment physical characteristics, and segment relationship to other segments. Up to 15 hierarchic levels can be defined. The maximum number of segment types for a single database is 255.

FIELD

Used to define a field within a segment. The maximum number of fields per segment is 255. The maximum number of fields per database is 1,000.

LCHILD

Used to define secondary index or logical relationship between two segments. It also is used to define the relationship between a HIDAM index and the root segment of the database.

XDFLD

Used to include when a secondary index exists. It is associated with the target segment and specifies the name of the indexed field, the name of the source segment and the field to be used to create the secondary index.

DBDGEN

Used to indicate the end of statements defining the DBD.

END

Used to indicate to the assembler that there are no more statements.

How to create DBD for the database already created?


Application programmer needs the structure of the database to use the database in application program. So application programmer will use the below technique to create DBDLIB.

DataBase Description (DBD)

Data Dictionary:

A Data Dictionary acts as a repository for information about all data in an environment. Common data dictionary products are CA10, IBM’s Data Dictionary and Data Manager.

Sample Data dictionary created by using DBDGEN will be like below.

PRINT	NOGEN
	DBD	NAME=COMPNYDB,ACCESS=HDAM
	DATASET	DD1=CMPN,DEVICE=3380
	SEGM	NAME=COMPANY,PARENT=0,BYTES=10
	FIELD	NAME=(CMPNCODE,SEQ,U),BYTES=10,START=1,TYPE=C
	SEGM  	NAME=PROJECT,PARENT=COMPANY,BYTES=5
	FIELD	NAME=(PROJCODE,SEQ,U),BYTES=5,START=1,TYPE=C
	SEGM  	NAME=BENCH,PARENT=COMPANY,BYTES=11
	FIELD	NAME=(BNCHCODE,SEQ,U),BYTES=11,START=1,TYPE=C
	SEGM  	NAME=PROJEMPL,PARENT=PROJECT,BYTES=15
	FIELD	NAME=(PEMPID,SEQ,U),BYTES=4,START=1,TYPE=C
	FIELD	NAME=(PEMPNAME,SEQ,U),BYTES=11,START=1,TYPE=C
	SEGM  	NAME=BNCHEMPL,PARENT=BENCH,BYTES=15
	FIELD	NAME=(BEMPID,SEQ,U),BYTES=4,START=1,TYPE=C
	FIELD	NAME=(BEMPNAME,SEQ,U),BYTES=11,START=1,TYPE=C
	DBDGEN
	FINISH
	END