AS400 Mid Range/record locking problem
Expert: Concise Systems/Laird Scranton - 12/19/2004
QuestionHi im using the chain operation to the same file.
after i use the update statement im not able to chain the same file again.
Before giving the chain statement for the second time i even tried using the unlck opcode for the file. Even then i get the same msg saying that file is locked,
plz suggest me some to get out of this problem
-------------------------
Followup To
Question -
Hi,
I have a problem in rpg 400
Im using a chain operation to a file,
then an update opcode after this
and again for the same file chain operation is performed
after which an update statement is there
when doing chain for the second time the pgm is exiting saying that its locked the file
i tried using unlck opcode before giving the second chain operation.
but again the same problem
could u please help me out of this problem
thanx in advance
Answer -
Are both chains to the same file name, or are you using the same file under two names? If both chains are to the same file name, then as soon as your program chains the second time to the file, the first lock is released automatically, so you should not be getting a lock message. If you are using the same file under two names, then after the first chain you have locked the record - if you try to chain to the same record a second time for update, you will get a lock message.
- Laird
AnswerThe problem does not make sense. Any lock you have on a record is automatically released when you chain to another record in the same file. Could there be another process running that has the record locked for update? You might use the WRKOBJLCK command to check for any other program which might have a lock.