KEEP CURRENT (COBOL)

The KEEP CURRENT statement places an explicit shared or exclusive lock on a record that is current of run unit, record, set, or area. Locks that are that placed on records through the KEEP CURRENT function are maintained for the duration of the database transaction, or until explicitly released by the COMMIT or FINISH statements.
idmscu
The KEEP CURRENT statement places an explicit shared or exclusive lock on a record that is current of run unit, record, set, or area. Locks that are that placed on records through the KEEP CURRENT function are maintained for the duration of the database transaction, or until explicitly released by the COMMIT or FINISH statements.
Syntax
►►─── KEEP ─┬─────────────┬─ CURRENT ─┬────────────────────┬─ . ──────────────►◄             └─ EXCLUSIVE ─┘           ├─ 
record-name 
──────┤                                       ├─ WITHIN 
set-name
 ──┤                                       └─ WITHIN 
area-name
 ─┘
Parameters
  • EXCLUSIVE
    Places an exclusive lock on the current record of run unit, record, set, or area. If you do not specify EXCLUSIVE, the record receives a shared lock by default.
  • record-name
    Places the lock on the current record of the specified record type.
  • WITHIN 
    set-name
    Places the lock on the current record of the specified set.
  • WITHIN 
    area-name
    Places the lock on the current record of the specified area.
Example
The following example places a shared lock on the current EMPLOYEE record occurrence:
KEEP CURRENT EMPLOYEE.
Status Codes
After completion of the KEEP function, the ERROR-STATUS field in the IDMS communications block indicates the outcome:
Status code
Meaning
0000
The request has been serviced successfully.
0606
Currency has not been established for the named record, set, or area.
0608
The named record or set is not in the subschema, or the current record of run unit is not a member of the named set.
0610
The subschema of the program specifies an access restriction that prohibits execution of the KEEP function.
0623
The named area is not in the subschema.
0626
The record to be kept has been erased.
0629
A deadlock has occurred while attempting to set the lock.