HP OpenVMS Systems Documentation
The HP COBOL data manipulation language (DML) is a programming language extension that provides a way for a COBOL application program to access a database. An HP COBOL database application program contains DML statements that tell the Database Control System (DBCS) what to do with specified data; the DBCS provides all database processing control at run time. The four classes of DML statements are data definition, control, retrieval, and update. An explanation of each class follows, together with important definitions of members of that class:
|SUB-SCHEMA SECTION||Is the first section of the Data Division. It contains two paragraphs: the Subschema entry (DB) and the Keeplist Description entry (LD).|
|DB||Names the target subschema, translates subschema record descriptions to compatible HP COBOL record descriptions, and creates a user work area (UWA).|
|LD||Names a keeplist to help you navigate through the database.|
|COMMIT||Terminates your transaction, makes permanent all changes made to the database since the last quiet point, and establishes a new quiet point for the run unit.|
|READY||Prepares selected realms for use.|
|ROLLBACK||Ends your transaction, cancels all changes made to the database since the start of your transaction, empties all keeplists, and nulls all currency indicators.|
|FIND||Locates a record in the database.|
|FIND ALL||Locates all specified records in the database and puts them in a keeplist.|
|FETCH||Locates a record in the database, retrieves its data item values, and places them in the user work area (UWA).|
|FREE||Releases references to records.|
|GET||Retrieves data item values of a previously located record and places them in the user work area (UWA).|
|KEEP||Remembers a record so you can later refer to it.|
|CONNECT||Makes a record a member in one or more sets.|
|DISCONNECT||Removes a record from one or more sets.|
|ERASE||Deletes records from the database.|
|MODIFY||Changes the contents of a record in the database.|
|RECONNECT||Moves a record from one occurrence of a set type to another (possibly the same) occurrence.|
|STORE||Adds a record to the database.|
Chapter 4 discusses the effects of the schema data definition language (DDL) INSERTION and RETENTION options on each of the DML update verbs.
Once a record has been located by a COBOL program, it can be changed or even erased from the database. DML programming operations also change the fundamental relationships within sets, causing records to change as well. For example, each set is owned by a record or Oracle CODASYL DBMS itself. If the program erases a record that is the owner of the set, all member records may also be deleted.
Section 4.5 contains more information on DML statements, database
conditional expressions, and the special registers DB-CONDITION,
DB-CURRENT-RECORD-NAME, DB-CURRENT-RECORD-ID, DB-UWA, and DB-KEY.
1.3 Creating an HP COBOL DML Program
When you create an HP COBOL DML program, you must include the
SUB-SCHEMA SECTION entry as the first section in the
Data Division. The SUB-SCHEMA SECTION is followed by a DB statement and
any LD statements. The Procedure Division contains all occurrences of
the DML verbs.
1.4 Compiling an HP COBOL DML Program
Your database administrator (DBA) creates schema and subschema definitions in Oracle CDD/Repository. These record definitions are defined in DMU format and are intended to serve all OpenVMS languages that might access them. In this format, the record definitions are not compatible with COBOL record definitions. Therefore, when the HP COBOL compiler retrieves the subschema definition from Oracle CDD/Repository, it translates the file into an internal form acceptable to the HP COBOL compiler.
If the translation results in compiler errors, they will probably be fatal.
You should alert your DBA to any errors resulting from a DB statement.
You can define the logical name CDD$DEFAULT as the starting schema node in Oracle CDD/Repository. There is only one logical name translation in the DB statement for schema-name. If you do not define it, CDD$TOP is the default.
You must recompile an HP COBOL DML program each time the subschema referenced by a DB statement is created. At compile time, the date and time of subschema creation (date and time stamps) are included with the translated subschema record definitions. If you do not recompile, your program will receive a fatal error at run time.