>Thanks Jordan for your reply, I don't understand your suggestion. Can you please make it a little more clearer. Thanks.
It is possible that two people access the same record at the same time. If the first locks the record with rlock(), the second - who will also try to lock with rlock() - will have to wait. Or the rlock() fails, and the program will try again.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)