I have a program written in RPGLE which calls numerous other programs. These programs all share similar files. In my main program, when trying to read a particular file, I get error CPF5032 even though I unlock the file right before I do the setll reade. As a result, I figured the lock must be coming from one of the called programs. However, I thought if I turned *INLR on before exiting the programs, all record locks would be released. Is this not true? Also, is there a way to tell which program actually has the record locked? As I said before, the program calls numerous other programs and it could be any one of them?
Software/Hardware used:
AS400 V5R4
ASKED:
May 4, 2011 6:39 PM
UPDATED:
February 21, 2012 10:35 AM
However, I thought if I turned *INLR on before exiting the programs, all record locks would be released. Is this not true?
Maybe. It might depend on how programs are compiled. What activation group does the outer program run in? How about the inner programs? What access methods are used? (At the simplest level, are these native I/O or SQL?) Are any overrides in effect at any level?
First thing to check is the CPF5032 error code shown in the 2nd-level text. What is it?
Tom
If you are locking the file in main program and if you try to access the same in one of the sub programs it will give the same result(i.e., CPF5032).
in this case, *INLR ON will actually not release the locks before calling subprogram.
But, If you are locking the file in one of the sub programs and once the sub program finishes(*INLR ON) you can access the same in main program or any other sub programs.
If you really dont need to update the file in main program then you can use ‘READ(N)’ while reading the file. So, that Main program will not lock the file(Similar to Sub programs also).
PRADEEP