When one user is updating the record of a file, another user wants to read the same record (same file)and will print the report in multi user environment.
In Micro Focus COBOL, opening the file INPUT does not avoid locks. If the file is locked, you cannot open it. If a record is locked, you must explicityly request that the lock be ignored by the above syntax.
Thanks for your response. But unfortunately IGNORE LOCK is not allowing (not working) our software MF COBOL 2.5 version. Kindly help me with alternate approach.
That said, let me also state that most key lock problems stem from bad design, not language shortcomings.
In order to avoid these problems, consider this. It is highly questionable for an application to lock more records than the current logical transaction requires. Furthermore, it takes extreme circumstances to warrant locking an entire file. And most importantly, a lock should not last more than a fraction of a second - in real time.
If a design takes into account the above considerations, it is hard to run into record locking issues.
To address your question, there are provisions in SQL type languages to read through locks. COBOL proper does not offer this, although many vendors have extensions you could use. If your documentation does not address this issue, than the only thing you can do is to issue your IO statements WITH TIME LIMITS (if your COBOL allows it).
Just remember, breaking and entering locked records exposes your application to bad/incomplete data.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.