Page 2 of 2

Posted: Fri Dec 23, 2016 8:50 am
by chulett
:!: Wait... you are writing to a single sequential file by multiple processes at the same time? Multiple readers are fine but multiple writers is generally what is known as a Very Bad Idea due to the nature of sequential media. The only thing that may save you is the LOCK part mentioned above so you certainly don't want to try and circumvent it.

I've seen far too many people do little limited tests of something like this in the past and declare everything "working fine"... and then the Real World comes along and things go off the rails. I don't believe you will see aborts but disengaging the LOCK will almost certainly corrupt your output file.

Posted: Fri Dec 23, 2016 9:46 am
by chulett
... and make sure you CLOSE the file in the routine, as Ray noted.

Posted: Sat Dec 24, 2016 5:06 pm
by ray.wurlod
Apy wrote:Just to clear my understanding, If LOCKED clause is not mentioned , any other invocation will wait until the file lock is released. Please confirm.
Confirmed.
Apy wrote:What if the LOCKED clause is mentioned? How other invocation will behave?
Is there any chance of abort for other job invocation due to same files accessed by multiple invocations at a time?
The routine will do whatever the code in the LOCKED clause specifies. For example, that code may sleep for a short period before trying again. In that case, no problem. Whether or not you can cause a job abort depends on a combination of your code and your operating system's rules.

Posted: Mon Dec 26, 2016 1:29 am
by Apy
Thanks for such a clear explanation. To avoid any future issue, I will go for using different files and then merge into one. This will prevent from any abort/Lock or unforeseen issue.

Thanks for the help!!!