[an error occurred while processing this directive]

HP OpenVMS Systems Documentation

Content starts here

HP COBOL
DBMS Database Programming Manual


Previous Contents Index

4.8.4 Translating DB-CONDITION Values to Exception Messages

Oracle CODASYL DBMS includes the following procedure for exception condition handling:


     CALL "DBM$SIGNAL".

Use this procedure when it is necessary to output an exception message rather than, or in addition to, displaying the numeric value of DB-CONDITION. For more information on the Oracle CODASYL DBMS database special register DB-CONDITION, see Section 2.2.1, DB-CONDITION.

4.9 Database Programming Statements in the COBOL Procedure Division

The HP COBOL Oracle CODASYL DBMS DML statements are:

  • COMMIT
  • CONNECT
  • DISCONNECT
  • ERASE
  • FETCH
  • FIND
  • FREE
  • GET
  • KEEP
  • MODIFY
  • READY
  • RECONNECT
  • ROLLBACK
  • STORE
  • USE (Format 3)
  • The RETAINING clause

COMMIT

Function

The COMMIT statement ends your database transaction, makes permanent all changes made to the database since the last quiet point, and establishes a new quiet point for this run unit.


stment

is an imperative statement executed for an on error condition.

stment2

is an imperative statement executed for a not on error condition.

Syntax Rules

  1. The STREAM clause cannot be specified if the subschema entry (DB) does not name a stream.

General Rules

  1. The COMMIT statement ends the database transaction.
  2. If you do not specify the STREAM clause, the COMMIT statement makes all changes made to the database since the last quiet point for this run unit; a new quiet point is established for the run unit.
  3. If you specify the STREAM clause, the COMMIT statement makes all changes made to the database since the last quiet point permanent for the specified stream; a new quiet point is then established for the stream.
  4. If you do not use the RETAINING clause (see Section 4.9.1, RETAINING Clause), COMMIT:
    • Empties all keeplists
    • Resets all your currency indicators to null
    • Releases all realm and record locks
    • Makes visible any changes you made to the database
    • Terminates the READY mode for each target realm
  5. If you do use the RETAINING clause, COMMIT:
    • Does not empty keeplists
    • Retains all currency indicators
    • Does not release realm locks
    • Demotes no-read record locks to read-only record locks, then releases locks for all records except those in currency indicators or keeplists

    • Makes visible any changes you made to the database
    • Maintains READY modes for each target realm
  6. If a database exception condition occurs during the execution of a COMMIT statement, the DBCS places a database exception condition code in the special register DB-CONDITION. This code identifies the condition.

Additional References

  • Section 2.2 on reserved words (database special registers)
  • HP COBOL Reference Manual, Chapter 6, section on scope of statements
  • Section 4.8.1, on database On Error condition
  • USE statement (Format 3)
  • Section 5.2.4, on subschema description (DB)

Example


COMMIT ON ERROR PERFORM 200-DISPLAY-ERROR-ON-COMMIT
               END-COMMIT.

CONNECT

Function

The CONNECT statement inserts the current record of the run unit as a member record into one or more sets. The set occurrence for each insertion is determined by the currency indicator for the corresponding set type.


record-name

names a subschema record type.

set-name

names a subschema set type.

stment

is an imperative statement executed for an on error condition.

stment2

is an imperative statement executed for a not on error condition.

Syntax Rules

  1. Record-name must reference a subschema record type.
  2. Set-name must reference a subschema set type.
  3. For each set-name in the TO set-name clause, the record type of record-name must be a member record type of the set type.
  4. The same set-name cannot be specified more than once in the TO set-name clause.
  5. The same set-name cannot be specified more than once in the RETAINING clause.

General Rules

  1. The current record of the run unit must be in a realm in ready update mode and all records required by the Database Control System (DBCS) to execute the CONNECT statement must be in a realm in available mode. The CONNECT statement uses the current record of the run unit.
  2. Use record-name to check that the current record of the run unit is a record type identical to the record-name record type.
  3. The current record of the run unit must not already be a member of set-name.
  4. For each set-name in the TO clause:
    1. The DBCS inserts the current record of the run unit into each set-name as determined by the set currency indicator associated with each set-name.
    2. The position where the DBCS inserts the record into the set is determined according to the criteria for ordering the set defined in the schema for set-name.
  5. When specifying the ALL option:
    1. The DBCS considers only those set types specified in your subschema for which:
      • The current record is not presently a member of any occurrence of the set type.
      • The record type of the current record is defined in the schema as a member record type of the set type.
    2. For each such selected set type:
      • The DBCS inserts the current record into the set determined by the set currency indicator associated with the selected set type.
      • The position where the DBCS inserts the current record into the set is determined according to the set-ordering criteria in the schema for the selected set type.
  6. Unless otherwise specified by the RETAINING clause (see Section 4.9.1, RETAINING Clause), set type currency indicators for the connected sets point to the connected record. All other currency indicators are not affected.
  7. If a database exception condition occurs during the execution of a CONNECT statement, the DBCS places a database exception condition code in the special register DB-CONDITION (see Technical Notes). This code identifies the condition.
  8. If the execution of a CONNECT statement results in a database exception condition, no changes are made to the membership of the current record in the database.

Technical Notes

CONNECT statement execution can result in these DB-CONDITION database exception condition codes:

DBM$_CRUN_NULL The currency indicator for the run unit is null.
DBM$_CRUN_POS The currency indicator for the run unit specifies the position of a vacated record in a record collection.
DBM$_WRONGRTYP The record type of record-name is not the same as the current record's type.
DBM$_NOT_MTYP The current record is not a member record type of a set in the TO set-name phrase.
DBM$_NOW_MBR The current record is already a member of the set specified in the TO set-name phrase.
DBM$_CSTYP_NULL There is no current of set type for the set specified in the TO set-name phrase. This occurs only if the set is not a singular set.
DBM$_DUPNOTALL The program attempts to connect a record to a set and its sort key value is identical to another record's sort key value already in the set.
DBM$_NOT_UPDATE A realm is not in update usage mode.
DBM$_CHKMEMBER The Oracle CODASYL DBMS CHECK (member) condition was evaluated to be false. The database remains unchanged.

Additional References

  • Section 2.2 on reserved words (database special registers)
  • HP COBOL Reference Manual, Chapter 6, section on scope of statements
  • Section 4.8.1, on database On Error condition
  • Section 5.14.1, on RETAINING clause
  • USE statement

Examples

  1. Connecting EMPLOYEE record to the CONSISTS_OF set:


    CONNECT EMPLOYEE TO CONSISTS_OF.
    
  2. Connecting EMPLOYEE record to all sets:


    CONNECT EMPLOYEE TO ALL.
    
  3. Connecting EMPLOYEE record to the CONSISTS_OF set without changing the currency indicator of the CONSISTS_OF set:


    CONNECT EMPLOYEE TO CONSISTS_OF
            RETAINING SET CONSISTS_OF CURRENCY.
    


Previous Next Contents Index