Technical data
4.7 Set Membership Options and DML Verbs
The HP COBOL data manipulation language (DML) verbs CONNECT,
DISCONNECT, ERASE, MODIFY, RECONNECT, and STORE can affect a
record’s set membership. The effects of these verbs depend on the INSERTION
and RETENTION clauses declared for the record’s membership in each set in the
schema.
The member’s INSERTION clause determines whether the record is automatically
inserted into a set when it is stored:
• If the INSERTION IS AUTOMATIC clause is used, the member is
automatically inserted into the set.
• If the INSERTION IS MANUAL clause is used, the member must be
manually inserted into the set with a CONNECT statement.
The member’s RETENTION clause determines whether the record can be
removed from a set with the verbs ERASE, DISCONNECT, and RECONNECT.
If the RETENTION IS FIXED clause is used, you cannot remove the record
from a set occurrence at all unless you erase the record at the same time. If the
RETENTION IS MANDATORY clause is used, you cannot use DISCONNECT to
remove the record from a set occurrence; you can use RECONNECT to move it
from one occurrence of the set type to another. If the RETENTION IS OPTIONAL
clause is used, you can use either DISCONNECT or RECONNECT to remove the
record from a set occurrence.
The ERASE statement always removes the erased record from all sets of which
it is a member. ERASE also affects sets owned by that record. If you use the
ERASE ALL option, all members of sets owned by an erased record are erased in
a recursive process. If you use ERASE without the ALL option, the effect on each
set member depends on the member’s RETENTION clause: FIXED members are
erased; OPTIONAL members are not erased (but are removed from the set, since
the set is about to vanish). If any members have a RETENTION MANDATORY
clause, an exception occurs because they can exist in the database without being
members of this set occurrence. However, the Database Control System does not
know into which set occurrence the members should be inserted.
The MODIFY statement may reposition a record within the same set occurrence
if its sort key for that set is one of the data items being modified.
See the Oracle CODASYL DBMS DML documentation that summarizes the
effects of the various verbs on the record directly modified and on any members
(ERASE only).
4.8 Programming for Database Exceptions and Error Handling
Your program must contain logic to accommodate exceptions and errors. The
items of syntax in HP COBOL that are used for this purpose are ON ERROR, AT
END, and USE.
4.8.1 Database On Error Condition
The database on error exception condition occurs when the DBCS encounters
a database exception condition for any data manipulation language (DML)
statement.
The ON ERROR phrase in a DML statement allows the selection of an imperative
statement sequence when any database exception condition occurs.
Procedure Division 4–15