Enscribe Programmer's Guide
SETMODE 4,6 and 4,7 can help applications to handle the asynchronous locking of alternate key
records caused by transaction aborts. With SETMODE 4,6, a process whose write to a primary
file collides with another process's system-generated lock of an aborting transaction will wait until
the system-generated lock is released. This approach makes the lock contention invisible to the
application in exchange for the possibility of an occasional lock wait. With SETMODE 4,7 in the
same situation, a process can receive error 73 when writing to a primary record for which it holds
a lock (because of a conflicting system-generated lock on an alternate key record). This approach
avoids lock waits in exchange for the need to design the process to handle error 73 on write as
retryable.
Relational Access
Relational access among structured files in a database is accomplished by obtaining a value from
a field in a record in one file and using that value as a key to locate a record in another file.
Figure 11 (page 38) shows an example of relational access. All four of the files that are shown
are primary data files. The illustrates a query operation in which the user wants to obtain information
about all orders that were placed on 10-17-95.
In response to the user query command, the application program uses the date alternate-key field
to locate the order summary records in the Order Header File that were placed on 10-17-95. For
each applicable order summary record, the program:
• Uses the Name field value from the order summary record as an exact primary key to obtain
the associated customer record from the customer file.
• Uses the Order Number field value from the order summary record as a generic primary key
to obtain the associated line item records from the order detail file.
• Uses the Part Number field value from the line item records as exact primary keys to obtain
the associated inventory record from the inventory file.
Alternate Keys 37