if both programs CHAIN to the file, are they locking the record?
If so, P2 will not be able to access the record because of the lock by P1.
When you chain to a file that is opened for update, unless you are going to update or release the record in the same cycle, you should chain with locking the record.
This is usually an interactive program where you need to wait for an ENTER key.
On the first chain, you should make a copy of the record.
Then on the enter key, you chain to the record again. Compare what you saved from the first chain and compare it to the second chain. If equal, go ahead and do your update.
If not equal, that means someone else has changed the record while you were waiting for the enter key. You would reject the change and send a message to the user on your DSPF saying someone else has changed the record. They should refresh their screen and try again