a big thanks to Jim Phillips for pointing me in the right direction.
The problem was that the program didn't have MR cap (which was
correct), but a buggy subroutine was calling FLOCK on a file, and never
calling FUNLOCK, so when the call came for DBLOCK, there was already a
lock in effect.
Thanks for everyone's input.