TurboIMAGE/XL Database Management System Reference Manual MPE/iX V6.5 (30391-90011)

Chapter 6 279
Host Language Access
COBOL II
NO ADVANCING
ACCEPT OPTION FREE
ELSE
PERFORM 1100-GET-ERROR-AND-EXPLAIN
END-IF
MOVE "Add Entry to Product Set End" TO TEXT1
MOVE 14 TO TEXTLEN
CALL "DBEND" USING DBNAME, TEXT1, DB-MODE, STATUS1, TEXTLEN
IF CONDITION NOT = 0 THEN
PERFORM 1100-GET-ERROR-AND-EXPLAIN
END-IF
CALL "DBUNLOCK" USING DBNAME, PRODUCT-MASTER, DB-MODE, STATUS1
IF CONDITION NOT = 0 THEN
PERFORM 1100-GET-ERROR-AND-EXPLAIN
END-IF.
Updating an Entry
This paragraph implements the UPDATE-A-CUSTOMER routine of the sample program. The
update process takes place in two phases.
In the first phase, the requested entry is located and retrieved. This is achieved by a call to
DBGET in mode 7. Then, the user provides the new values.
In the second phase, the recently modified values replace the existing entry. This is
implemented using a call to DBUPDATE. Before this call, the paragraph starts a
TurboIMAGE/XL transaction bracketed by calls for locking the volatile item. To retrieve
the entry, DBGET is called in mode 1. This call retrieves the entry located in the previous
stage.
The paragraph must confirm that values retrieved in the first stage are still residing in the
same entry. This should be done before the actual update. If the contents of the buffers are
the same, the paragraph can continue with the operation. Otherwise, it should end the
transaction and release the locks.
The exceptional condition for this paragraph is status 17. This indicates that the requested
entry does not exist or is empty.
******************************************************************
* ACCESS : Mode 1 - Shared Modify Access
*
* Called By: 30-DO-ACTION
*
* Calls : DBGET in mode 7 (calculated)
* DBLOCK in mode 5 (unconditional)
* DBBEGIN in mode 1 (transaction begin)
* DBGET in mode 1 (re-read)
* DBUPDATE in mode 1 (update)
* DBEND in mode 1 (transaction end)
* DBUNLOCK in mode 1 (unlock)
* 1100-GET-ERROR-AND-EXPLAIN
700-UPDATE-A-CUSTOMER.
SET NOT-FOUND TO TRUE
DISPLAY CLEAR SCREEN
DISPLAY "Enter the Account # for The Customer Master"
NO ADVANCING
DISPLAY "---------> " NO ADVANCING