I'm running db2 subroutines in cobol environment. The first time the subroutine is called the record is found. The second time the record is not found even though it exists on the table. It doesn't matter if I'm calling the same record again or a different one. If i cancel between subroutine calls, the record is found the second time through, but there are other reasons I don't want to cancel the subroutine each time. Any ideas on why this is happening and what can be done to correct it?
I've explained this badly. What I've got is a program A, calling subprogram B which calls subprogram Z, program A also calls subprogram C which calls subprogram Z. My problem is Z appears to work correctly except that any db2 select statements return +100 when called from C.