Technical data
5.2.1 Database
A database is a collection of your organization’s data gathered into a number of
logically related units. The database administrator (DBA) and representatives
from user departments decide on the organization’s informational needs. After
these individuals agree on the contents of the database, the DBA assumes
responsibility for designing, creating, and maintaining the database.
5.2.2 Schema
The schema is a program written by the DBA using DDL statements. It describes
the logical structure of the database, defining all record types, set types, areas,
and data items in the database. The DBA writes the schema independently of
any application run unit. Only one schema can exist for a database. For a more
detailed description of the schema DDL, refer to the Oracle CODASYL DBMS
documentation on database administration and design.
5.2.3 Storage Schema
The storage schema describes the physical structure of the database. It is written
by the DBA using data storage description language (DSDL) statements. For a
complete description of the storage schema, refer to the Oracle CODASYL DBMS
documentation on database administration and design.
5.2.4 Subschema
The subschema is a subset of the schema; it is your run unit’s view of the
database. The DBA uses the subschema DDL to write a subschema, defining
only those areas, set types, record types, and data items needed by one or
more run units. You specify a subschema to be used by your run unit with
the DB statement. A subschema contains data description entries like the
record description entries you use for file processing. However, subschema data
description entries are not compatible with COBOL data description entries;
the HP COBOL compiler must translate them. The translated entries are made
available to the COBOL program at compile time. By using the /MAP compiler
qualifier, you obtain a database map showing the translated entries as part of
your program listing.
Many subschemas can exist for a database. For further information on writing
a subschema, refer to the Oracle CODASYL DBMS Database Administration
Reference Manual.
5.2.5 Stream
A stream is an independent access channel between a run unit and a database.
A stream has its own keeplists, locks, and currency indicators. You specify a
stream to be used by your run unit with the DB statement. Streams let you do
the following:
• Access multiple subschemas within the same database
• Access multiple databases
Because streams can lock against one another, it is possible to deadlock within a
single process.
In HP COBOL, you can only specify one stream per separately compiled program.
To access multiple subschemas within the same database or multiple databases,
you must use multiple separately compiled programs and execute calls between
the programs. For example, to gain multiple access to the databases OLD.ROO
and NEW.ROO, you could set up a run unit as follows:
Database Programming with HP COBOL 5–3