AS400 Mid Range/record locking problem

Advertisement


Question
Hi 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

Answer
The 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.

AS400 Mid Range

All Answers


Answers by Expert:


Ask Experts

Volunteer


Concise Systems/Laird Scranton

Expertise

General AS/400, RPG/400, SDA and CL programming questions. AS/400 performance tuning.

Experience


Past/Present clients
CB Sportswear
Coca-Cola of New York
Encore Paper Company
Golub Corporation
HBO Home Video
Imperial Pools
Kaiser Permanente of NE New York
Mallinckrodt Medical
Marigold Foods
Manpower & Associates
National Datacomputers
New York State Easter Seals Society
New York State Food Merchants Association
Pepsi-Cola Allied Bottlers
Petricca Construction
Taconic Telephone Corporation
TOMRA Recycling
Unistress Corporation

©2012 About.com, a part of The New York Times Company. All rights reserved.