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

250 Chapter6
Host Language Access
ORDERS Database Model Program
BEGIN ROUTINE
OBTAIN DBname " ORDERS;"
OBTAIN Password "DO-ALL;"
CALL DBOPEN (DBname, Password, Mode1_SMA, Status)
ERROR CHECKING
END ROUTINE
Retrieving All the Records on a Chain (with Item Level Locking)
(USER SELECTS 2 TO RETRIEVE SALES DATA)
ROUTINE: Get_Sales_For_Date
* OBJECTIVE: This routine demonstrates chained access, forward chained
* read, and data item locking.
*
* The routine retrieves all sales records generated
* on a particular purchase date. The value for date is
* provided by the user and is used as the search item.
* Due to concurrency issues, a data item lock is acquired
* on all sales records identified by the date.
*
* ACCESS: Mode 1 - Shared Modify Access
*
* CALLED BY: Main Line
*
* CALLS: DBLOCK in mode 5 (unconditional)
* DBFIND in mode 1 (chained access)
* DBGET in mode 5 (forward chained read)
* DBUNLOCK in mode 1 (unlock)
BEGIN ROUTINE
Sales_Buffer is made up of:
Account
Stock#
Quantity
Price
Tax
Total
Purch-Date
Deliv-Date
Lock_Descriptor_Sales_Type is made up of:
Length_Of_Descriptor
Data_Set_Of_Descriptor
Data_Item_Of_Descriptor
Relative_Operator_For_Data_Item
Value_For_Data_Item
Lock_Descriptor_Sales_Array_Type is made up of:
Number_Of_Elements
Lock_Descriptor_Sales_Type
The following illustration shows the layout for a lock descriptor array formats after the
actual values have been assigned. Note that the date is stored in YYMMDD format.