MrConfused 0 Light Poster

I always open a file just before it it written to, then close it as soon as practical. I have always wondered what would happen in this scenario:-

Your program is on a server and two people use a shortcut from their stations to run it. All the file access in the program is set to "random shared". One uses the program to change record 10, but at almost exactly the same time the other person does the same. The first person is using a feature that has 100 lines of code to do after the file is opened and before the "put" statement is executed. The second person is using another feature of the program, but once the file has been opened only ten lines of code need to be done before the "put" statement. The question is which "put" statement will change the file first. Does the "random shared" form of access allow some sort of queing at system level, or would the second persons info be put in the file, then get swiftly overwritten by the first persons new info.

I know the file could be opened for "random lock write", but I have often wondered about the above scenario.