TurboIMAGE/XL Database Management System Reference Manual MPE/iX V6.5 (30391-90011)
Chapter 6 271
Host Language Access
COBOL II
DISPLAY "-----------------------------------"
DISPLAY "Press Enter to Continue... "
NO ADVANCING
ACCEPT OPTION FREE
END-EVALUATE.
Opening the Database
This paragraph implements the OPEN-THE-DATABASE routine of the sample program in
COBOL II. All required values, such as the password, are provided by the routine. Note
that the password DO-ALL establishes user class number 18. The password DO-ALL is
followed by a semicolon because it is less than eight characters long; a blank can be
substituted for the semicolon. OPEN-THE-DATABASE uses open mode 1, which is the shared
modify access mode. Error trapping is done by referring all non-zero conditions to
paragraph 1100-GET-ERROR-AND-EXPLAIN.
******************************************************************
* ACCESS : Mode 1 - Shared Modify Access (SMA) with locking required
*
* Called By: 30-DO-ACTION
*
* Calls : DBOPEN in mode 1 (SMA)
* 1100-GET-ERROR-AND-EXPLAIN
100-OPEN-THE-DATABASE.
MOVE SPACES TO BASEID
MOVE "ORDERS" TO BASENAME
MOVE ";" TO TERMINATOR
MOVE "DO-ALL;" TO PASSWORD
MOVE 1 TO DB-MODE
CALL "DBOPEN" USING DBNAME, PASSWORD, DB-MODE, STATUS1
IF CONDITION NOT = 0 THEN
PERFORM 1100-GET-ERROR-AND-EXPLAIN
END-IF.
Retrieving All the Records on a Chain (with Item Level Locking)
This paragraph implements the GET-SALES-FOR-DATE routine of the sample program.
Chain access is achieved using a call to DBFIND to determine the location of the first and
last entries in the chain. The search item used for this call is PURCH-DATE. An item level
lock is obtained on the value of the search item before the DBFIND call. After that,
individual chain items are retrieved, until the end of the chain is encountered. This is done
using multiple calls to the DBGET procedure.
The routine traps two exceptional conditions:
1. Status condition 17 from the DBFIND call, indicating that the chain head cannot be
located.
2. Status 15 from the DBGET call, indicating the end of the chain.
The status interpretation routine permits you to either abort or continue with the
execution after viewing all error messages.