|
> I'm trying to have a program detect if a record is locked. > If the program does find that the record it's trying to read > is locked, it will wait 10 seconds before retrying to read > the same record from the file. The code you posted looks like it will do what you want. Beware of a deadly embrace though. Job A locks record 1 in file A. Job B locks record 1 in file B, then tries to read file A. Record is locked, goes into retry loop. Job A tries to read file B. Record is locked, goes into retry loop. Each job waits for the other job to release it's lock. An option to consider is to do an automatic retry for n number of attempts, or n minutes before 'giving up.' Giving up can mean your program posting a message (not the system error handler) to QSYSOPR to have the operator clear the lock and then continue. Your code can read the response and begin another round of retry loop. You can guess how I came to use this particular construct. Timing is EVERYthing. --buck
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.