The #KEEP statement is used in DC/UCF pseudo-conversational transactions to establish long-term record locks and to monitor access to records between tasks. Long-term database locks can be shared or exclusive:
If a record has been locked with a #KEEP request, restrictions may exist on the type of lock that can be placed on that record by other run units, based on existing locks and whether the requesting run unit is executing on the same logical terminal as the run unit that originally placed the lock on the record. The following table illustrates these restrictions.
|
Type of lock in effect |
Type of lock allowed for other run units |
Type of lock disallowed for other run units |
|---|---|---|
|
Shared |
Shared and longterm shared |
Exclusive and longterm exclusive |
|
Exclusive |
None |
Shared, exclusive, longterm, shared, and longterm exclusive |
|
Longterm shared |
For all run units: shared and long term shared For run units on the same terminal: exclusive and longterm exclusive |
For run units on other terminals: exclusive and longterm exclusive |
|
Longterm exclusive |
For run units on the same terminal: shared exclusive, longterm shared, and longterm exclusive |
For run units on other terminals: shared exclusive, longterm shared, longterm exclusive |
Tasks can monitor database activity associated with a specified record during a pseudo-converse and, if desired, can place a long-term lock on the record being monitored. A subsequent task can then make inquiries about that database activity for the record and take the appropriate action.
The system maintains information on database activity using five-bit flags, each of which is either turned on (binary 1) or turned off (binary 0). This information is returned from the system to the low-order byte of register 0 as a numeric value. The bit assignments, the corresponding numeric value returned to the program, and a description of the associated database activity follows:
The record has been physically deleted.
The record has been logically deleted.
The record's prefix has been modified, that is, a set operation (for example, @CONNECT or @DISCON) occurred involving the record.
The record's data has been modified.
The record has been obtained.
Any combination of these bits may be set. To determine the action or combination of actions that has occurred, you can compare the numeric value returned to the program in register 0 with an appropriate constant; for example:
The maximum possible value is 31 (X'1F'), indicating that all the above actions occurred for the monitored record. The example of the #KEEP statement, shown later in this topic, illustrates a test for the value of the five bit flags returned by the system to the low-order byte of register 0.
You may prefer to monitor database activity across a pseudo-converse rather than to set long-term locks. Long-term locks can prevent access to a record by other run units for an undesirably long time if, during a pseudo-converse, the terminal operator fails to enter a response. Monitoring does not restrict access to database records, sets, or areas by other run units; however, it does enable a program to test a record for alterations made by other run units. When long-term locks are used, it may be desirable to release those locks at specified timeout intervals.
Note: For more information about the use of timeout intervals, see the System Generation Guide.
|
Copyright © 2014 CA.
All rights reserved.
|
|