Problematic code:
READ FILE-A RECORD WITH LOCK
INVALID KEY DISPLAY 'MVSCKEY NOT FOUND EXCLUSIVE'
Better approach:
READ FILE-A RECORD
NOT INVALID KEY
... process ...
INVALID KEY
DISPLAY 'RECORD NOT FOUND: KEY=' WS-KEY
If exclusive lock is required after existence is confirmed:
READ FILE-A RECORD
INVALID KEY
DISPLAY 'NOT FOUND'
EXIT PERFORM
END-READ
* Now reread with lock (risky if deletion occurs in between)
READ FILE-A RECORD WITH LOCK
INVALID KEY
DISPLAY 'RECORD DISAPPEARED BEFORE LOCK'
For safety, use CICS or VSAM recoverable files. mvsckey not found exclusive
If the VSAM index component is out of sync with the data component (e.g., due to an aborted VERIFY or improper close), the index may point to an RBA that doesn’t exist. The key appears "not found" even though the record physically exists.
If mvsckey represents a session token or temporary API key:
If using alternate indexes:
LISTCAT ENTRIES(your.aix.path) ALL
Confirm the base cluster is not in a 'SUSPENDED' state.
VSAM KSDS files have two components:
When your program executes:
READ VSAM-FILE INTO RECORD-WORK
WITH KEY (CUSTOMER-ID)
UPDATE
The system performs these steps:
If Step 1 fails (the CKEY is not in the index), the system cannot proceed to Step 3. But because the UPDATE clause requests exclusive control, the error thrown is not a generic "record not found"—it is specifically "MVSCKEY NOT FOUND EXCLUSIVE."
Error Interpretation
The service account running ESET services (e.g., NT AUTHORITY\SYSTEM) may lack exclusive write access to the database file because another process (or a manual lock) is holding it open.
Problematic code:
READ FILE-A RECORD WITH LOCK
INVALID KEY DISPLAY 'MVSCKEY NOT FOUND EXCLUSIVE'
Better approach:
READ FILE-A RECORD
NOT INVALID KEY
... process ...
INVALID KEY
DISPLAY 'RECORD NOT FOUND: KEY=' WS-KEY
If exclusive lock is required after existence is confirmed:
READ FILE-A RECORD
INVALID KEY
DISPLAY 'NOT FOUND'
EXIT PERFORM
END-READ
* Now reread with lock (risky if deletion occurs in between)
READ FILE-A RECORD WITH LOCK
INVALID KEY
DISPLAY 'RECORD DISAPPEARED BEFORE LOCK'
For safety, use CICS or VSAM recoverable files.
If the VSAM index component is out of sync with the data component (e.g., due to an aborted VERIFY or improper close), the index may point to an RBA that doesn’t exist. The key appears "not found" even though the record physically exists.
If mvsckey represents a session token or temporary API key:
If using alternate indexes:
LISTCAT ENTRIES(your.aix.path) ALL
Confirm the base cluster is not in a 'SUSPENDED' state.
VSAM KSDS files have two components:
When your program executes:
READ VSAM-FILE INTO RECORD-WORK
WITH KEY (CUSTOMER-ID)
UPDATE
The system performs these steps:
If Step 1 fails (the CKEY is not in the index), the system cannot proceed to Step 3. But because the UPDATE clause requests exclusive control, the error thrown is not a generic "record not found"—it is specifically "MVSCKEY NOT FOUND EXCLUSIVE."
Error Interpretation
The service account running ESET services (e.g., NT AUTHORITY\SYSTEM) may lack exclusive write access to the database file because another process (or a manual lock) is holding it open.