You know how you can look at something many times and just not see what right in front of you. Well I think I found the problem, some of the programs where getting the number (say 100), using that number, then adding one to it (101) and updating the file. Other programs are getting the number (100), adding one to it (101), using that number, then updating the file. So you could get two users with the number 101. Thanks for your inputs.:)
all such problems have underlying causes in areas where we are not looking. I am sure the record locking is working. The most obvious possible problem is the a) not found condition for the chain, or b) the not eof condition for the read, or c) the misplaced Set Lower Limit. Is there only one record in the control file? if not, the read might be getting the wrong record. Is this the case?
I do not think it is a locking problem.