Files and Data: Checking, Recovery and Locks
How to get a list of the files in which your Appx session holds record locks?
The .FM_GET_LOCKS engine function will populate a memory file with a list of file names - each name corresponds to a file that your session holds a lock in. You may hold more than one lock in any given file (the record count and primary keys are *not* stored in the memory file).
To obtain the list:
PASS 0DB PATH FILE SHARE? Y
CALL .FM_GET_LOCKS RESIDENT? N END? N FAIL 0
Here's the layout of the 0DB PATH memory file:
Dsp -Options-- Seq No Field Name Field Type Seq Format T DL AA KC
100 PATH REC GROUP HEADER 5 T
200 PATH SCOPE DOMAIN 9(7)
300 PATH FI AP DOMAIN &&& 400 PATH FI VER DOMAIN && 500 PATH FI NAM DOMAIN &&&&&&&& P
600 PATH DB DOMAIN X(3)
700 PATH SRC AP DOMAIN &&& 800 PATH SRC VER DOMAIN && 900 PATH FI TYPE DOMAIN 9(1) AA
1000 PATH REC TRAIL GROUP TRAILER 5 T
Since you're using this function as a diagnostic tool, you're mostly interested in the PATH FI NAM.
You might want to add this function to your DIRECT PROCESS 1 process so you can view a list of locks from anywhere within your application. You may also want to add a
COMMIT option to your DIRECT PROCESS 1 process so that you can clear all locks held by your process.