On Fri, 26 Mar 2021 09:21:59 -0400, Joseph Reichman wrote: >The chances of two jobs writing to the file are slim and none I am searching >a large number of files because I cannot find the data > https://en.wikipedia.org/wiki/Murphy%27s_law
> And most importantly it is NOT a production job > It seems unusual to be "searching a large number of files" in what "is NOT a production job". What is your procedure for detecting contention? What is your recovery process? I'll suggest using for output a UNIX file opened with O_APPEND. Be sure your writes are atomic. >-----Original Message----- >From: Jeremy Nicoll >Sent: Friday, March 26, 2021 9:13 AM > ... >That won't work if two jobs simultaneously try to write to the file. > >You might not destroy the file, but you will lose the information that the >second job tried to write to it. > >The jobs need > >(a) not to allocate the output dataset at all in the JCL > >(b) to have a retry loop that does something like the > following when you want to write data out > > repeat > try to get exclusive use of the results file > If you have authority, use S99WTDSN # ########################## > if that fails and we've tried many times, > perhaps write the data somewhere else? > - though that might also fail > stop trying > end > > if exclusive use isn't acquired but we've not tried > often, wait a bit (a random time interval) and > try again > > if exclusive use was granted, update the file, > free it again, and stop trying > Else? # ################################## > end -- gil ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
