I'm guessing here but any OS function that does just a read should exert just the lowest level of lock here such as shared for update. But another user job wanting to exert an exclusive lock should fail. I suggest you ask someone who knows about this user job if it really needs an exclusive lock? Can it use a lower level of lock such as "exclusive allow read" which would solve your issue ? But I do not really know if exclusive allow read lock is available for an IFS object or not. Could not find it with Google search.
Chance favors only the prepared mind.
Satid S.
Original Message:
Sent: Tue September 26, 2023 09:58 AM
From: David Hammond
Subject: Does qsys2.ifs_read lock file?
Thanks for your answers.
We were attempting to read a production IFS file that is being written to 24 hours a day without impacting the production job. Unfortunately, using qsys2.ifs_read caused the production job to fail due to not being able to write to the log file that was being read by ifs_read.
We have alternatives, but were hoping to determine if the ifs_read table function locks the file being read by design or if it is a bug.
------------------------------
David Hammond
Original Message:
Sent: Sun September 24, 2023 05:07 AM
From: Satid Singkorapoom
Subject: Does qsys2.ifs_read lock file?
On second thought, reading a 25+MB file should not take long to finish unless the disk response time is particualrly bad. Does your IBM i server still use hard disk and you happen to read the file at issue during high workload period when disk response time degrades badly? If so, you are well advised to do this in low workload period instead.
------------------------------
Chance favors only the prepared mind.
-- Louis Pasteur
------------------------------
Satid S.
Original Message:
Sent: Fri September 22, 2023 08:46 AM
From: David Hammond
Subject: Does qsys2.ifs_read lock file?
When attempting to read a large log file (25+ MB) using QSYS2.IFS_READ in Run SQL Scripts, a java process attempted to write to the file while the statement was running and received an error:
java.io.FileNotFoundException (The requested resource is busy.)
SQL statement:
select *
from table(
qsys2.ifs_read(
path_name => '/home/logs/log-2023-09-21.txt',
end_of_line => 'LF'
)
);
Does QSYS2.IFS_READ lock the file being read? If so, is there a way to avoid this?
------------------------------
David Hammond
------------------------------