Technical data

8
Database Programming Examples
The next few pages show programming examples of how to do the following:
Populate a database
Back up a database
Access and display database information
Create new record relationships
This chapter also provides an example of how to create a bill of materials and
sample runs of some of the programming examples.
8.1 Populating a Database
The DBMPARTLD program in Example 8–1 loads a series of sequential data
files into the PARTS database. The PARTS database consists of a NEW root
file with a default extension of .ROO describing the database instance and a
series of .DBS storage files containing the actual data records. PARTS is the
schema relative to the current position in CDD/Repository when the program is
compiled. As the DBCS inserts the records, it creates set relationships based on
the PARTSS1 subschema definitions. In the DB statement PARTS and NEW can
be logical names. If PARTS is not a logical name, HP COBOL appends PARTS to
CDD$DEFAULT; for example, CDD$DEFAULT.PARTS. If NEW is not a logical
name, the DBCS appends .ROO as the default file type; for example, NEW.ROO.
Example 8–1 Populating a Database
IDENTIFICATION DIVISION.
PROGRAM-ID. DBMPARTLD.
**********************************************************
* *
* This program loads the PARTS database *
* *
**********************************************************
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
(continued on next page)
Database Programming Examples 8–1