Page 1 of 1
Detect CLRPFM action from other job
Posted: Fri Sep 26, 2025 3:49 pm
by samyap
Hi, I have a job (Job A) that run 24*7 and will opens a file (FILE_A).
Another job (Job B) need clears this file using CLRPFM.
How can my job A detect when CLRPFM is performed by Job B to release locking on FILE_A without modifying Job B program?
Re: Detect CLRPFM action from other job
Posted: Fri Sep 26, 2025 4:16 pm
by Scott Klement
Why does JOB_A need to have FILE_A open all the time? It seems to me that if it's okay for JOB_B to run CLRPFM, it means that JOB_A isn't using the file for anything. If it was, it would lose all of the data it is working with. The problem isn't really the object lock, its that the data is needed by JOB_A so wiping the data out would be harmful. (The object locks are there to protect you against it.)
But if you are saying that JOB_A doesn't mind the data being cleared, then perhaps JOB_A has no reason to have the file open all the time? It doesn't truly use it. In this case, it should be designed to not keep the object open and locked... if it only opens and locks it when it needs it, then there's no conflict with JOB_B.
Re: Detect CLRPFM action from other job
Posted: Mon Sep 29, 2025 7:05 am
by peder udesen
I have had a situation where records in a log file should be transferred to an archive file.
Originally it was done using CPYF and CLRPFM but due to the fact that the system now
is running 24x7 it was no longer possible. The log file could be open at any time.
Instead I made a program that read the log file, write to the archieve file and then delete
the record in the log file.
The log file was changed with REUSEDLT(*YES)
The amount of records are almost the same week by week so the size of the log file didn't
change -- that is the sum of active records and deleted records were the same.
The reason I did it this way was that it was not possible to reorganize while active.