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

Chapter 6 291
Host Language Access
FORTRAN 77
Pass_Word='DO-ALL;'
Call DBOPEN (DBname,Password,Mode1_SMA,Status)
If (Condition.NE.0) Then
Call Get_Error_And_Explain
EndIf
Return
End
Retrieving All the Records on a Chain (with Item Level Locking)
This procedure implements the Get_Sales_For_Date routine of the sample program.
Chained access is achieved using a call to DBFIND. 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 chain is
encountered. This is done using multiple calls to the DBGET procedure.
This routine traps two exceptional conditions:
1. Status condition from the DBFIND call, indicating that the chain head cannot be located.
2. Status 15 from DBGET, 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.
C***************************************************************
Subroutine Get_Sales_For_Date
C ACCESS : Mode 1 - Shared Modify Access
C
C CALLED BY : Main Line
C
C CALLS : DBLOCK in mode 5 (unconditional item level locking)
C DBFIND in mode 1 (chained access)
C DBGET in mode 5 (forward chain read)
C DBUNLOCK in mode 1 (unlock)
C***** Get_Error_And_Explain (chained access)
$list off
$include 'comon1'
$list on
C** The Input/Output indicator values
Parameter (In=5,Out=6)
Integer*4 End_Of_Chain,No_Chain_Head
C** Set up for the data set parameter.
Character Data_Set_Name_Is*16
Integer*2 Sales_Detail(8)
Equivalence (Sales_Detail(1),Data_Set_Name_Is)
C** Set up for the search item parameter.
Character Search_Item_Name_Is*16
Integer*2 Search_Item_Name(8)
Equivalence (Search_Item_Name(1),Search_Item_Name_Is)
C** Set up for the search value/argument parameter.
Character Search_Item_Value_Is*6
Integer*2 Search_Item_Value(3)