Can ODBC/JDBC programs place EXCLUSIVE locks?

Document ID : KB000116827
Last Modified Date : 03/10/2018
Show Technical Document Details
Introduction:
This article discusses options for placing exclusive locks on CA IDMS record occurrences via ODBC or JDBC.
Background:
With network DML, a CA-IDMS program can explicitly place EXCLUSIVE LOCKs on database record occurrences without actually updating them.

OBTAIN KEEP EXCLUSIVE

Is there any way to do this with an ODBC or JDBC program?
Environment:
CA IDMS, any supported releases.
Instructions:
There is no ODBC/JDBC syntax to place EXCLUSIVE LOCKs on a database record.

CA-IDMS does have a "FOR UPDATE" clause on a SELECT statement, but it is there to assist with optimization, not place locks.

SELECT * FROM EMPNET.DEPARTMENT FOR UPDATE;

The only way to force EXCLUSIVE LOCKs on records in CA-IDMS/Server based programs is to use one of these two options:
1. Issue a dummy UPDATE which does not change any row values. A SET clause is necessary so you will need to provide something like this:
UPDATE DEPARTMENT SET DEPT_NAME_0410=DEPT_NAME_0410 WHERE DEPT_ID_0410=5300;
2. Write a PROCEDURE to accept the ROWID of the record and use network DML to place the lock:
OBTAIN KEEP EXCLUSIVE DB-KEY WS-DB-KEY PAGE-INFO WS-PAGE-INFO.
By using the PAGE-INFO passed as part of the ROWID, the PROCEDURE doesn't need to specify the record-name and so one PROCEDURE can be used for an entire SUBSCHEMA.
Additional Information:
FIND/OBTAIN (COBOL)
Defining and Using Procedures
SELECT
UPDATE
Locking Records