It has been 23 years since I’ve even looked at a COBOL program.
When you call the second ‘online’ program and the screen without records is shown, go to another session and type WRKOBJLCK PRDATA-FILE *FILE and see what kind of locks are on the file and where they are.
In RPG, if you are not updating, the file would be defined as Input Only. Or, if the program does update, but not while retreiving records, you would read(n) or chain(n) (no lock) until right before actually wanting to write or update the file. Then read/chain without the (n) and write/update. When you write/update the file record is unlocked.
Another option is in program 1, close the file before calling program 2.
All of this said IF the issue is a file/record lock.
It could just be a key out of whack or your code. Please send code….