|
> What is the best / most efficient way to code for > a record / file lock error in RPGiv? Beats me what the best might be. But here are some things to consider: a record lock is an I/O error, so you'll have to trap it. Your choices are an indicator in the LO columns, the (e) extender on the CHAIN or READ, *PSSR or perhaps MONITOR. I tend to use the extender and the %error BIF. c MasKey Chain(e) RMASTER c if %error c dump c endif Once you've trapped the I/O error, you should probably check to see exactly what sort of I/O error you have, because you could have something unpleasant like a damaged file. FMaster UF E K Disk F INFDS(MasFeedback) DMasFeedback DS D StsMasStatus *STATUS StsMasStatus is 01218 for a record lock. Other status codes can be found in the Error Handling chapter of the RPG Reference manual. Never assume that all I/O errors are record locks. That will give someone in the future a Bad Day. You may want to report some details about which other process is holding the lock. The program status data structure can help: D SDS D StsErrMsg 91 170 StsErrMsg holds the text of the CPF5027 error message. Assuming that you want the record lock to occur, you might consider changing the WAITRCD parameter on the file (either through CHGPF or OVRDBF) to a smaller value than the default of 60 seconds. If an interactive user is waiting on a lock, 60 seconds can seem like an eternity. ovrdbf master waitrcd(3) call rcdlock2 Record 1648 in use by job 497089/BUCK/TN5250. Never trap an error and then ignore it. If you trap an error, DO something - even if it is a DUMP and RETURN out of the program. Ignoring the error will definitely cause someone in the future to have a Bad Day. --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.