Technical data
5.8 Set Types
A set type is a named relationship between two or more record types. The major
characteristic of a set type is a relationship that relates one or more member
records to an owner record. The owner and members of a set are called tenants of
the set. For example, the PART record type could own a SUPPLIER record type
in the set PART_INFO.
As with records, the DBA describes set types in the schema; set occurrences
exist in the database. The unqualified term set implies set occurrence. A set
occurrence is the actual data in the set, not its definition, which is the set type.
Figure 5–1 illustrates a set relationship using a Bachman diagram.
Figure 5–1 Bachman Diagram
PART
SUPPLY
Owner
Member
Tenants
Set type PART_INFO
ZK−1479−GE
A Bachman diagram shows how member records are linked with owner records
by arrows that point toward the members. It is a graphic representation of
the set relationships between owner and member records used to analyze and
document a database design. This simple format can be extended to describe
many complex set relationships. The Oracle CODASYL DBMS documentation on
data manipulation contains a complete Bachman diagram of the PARTS database.
Most of the examples in this chapter use the set types in the PARTSS1 and
PARTSS3 subschemas (see the subschema compiler listings in Section 7.3, and
the Bachman diagrams in this chapter, Figure 5–2 and Figure 5–3). Figure 5–4
and Figure 5–5 contain three PART records, two VENDOR records, and six
SUPPLY records. The SUPPLY records show suppliers’ lag times. Lag time starts
when an item is ordered and ends when the item is received.
The examples assume the records are in the following order:
1. PART record type: LABEL, CASSETTE, TAPE
2. SUPPLY record type: 4-DAYS, 2-DAYS, 1-MONTH, 1-WEEK, 2-WEEKS,
5-DAYS
5–6 Database Programming with HP COBOL