Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Handling Record Locks in MF Cobol on AIX O/S

Status
Not open for further replies.

inguva

Programmer
Jan 15, 2002
3
IN
Hi,

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.

How do I handle the above situation.

thanks,
IVLNR.
 
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.
 
Hi,

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.


Thanks
 
Just a thought...

It is not a helluva good idea to read through locks. The purpose of locking records is primarily to protect transaction integrity.

Dimandja
 
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.

Dimandja
 
Don't know for MF 2.5, but for 3.1 it's accurate.
Take a look at your cobconfig file for this parameters:
set lock_mode=
set skip_on_lock=

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top