As400 rpg lock file


















Comment Post Cancel. Re: File Lock besides LR if you chain to a file when its an update file you must release the lock prior to leaving the program or a lock will remain. Yes I'm talking to you squirrel nuts. July 7, , AM. Re: File Lock Hi, yet an other question: Are you files registered in a journal and are you working with commitment control?

Btw a record locked under commitment control cannot be released with the N -extention in RPG! July 8, , PM. Re: File Lock hi. Hauser : no journel is attached to that file. July 9, , AM. Re: File Lock Hi, It wasn't clear intially, but is the message "locked to this job" or simply "Already in use". If it is the later then this means that some other job, process or user is using this member.

A combination of the things mentioned in the other responses should help you resolve this. Line 14 — I need to give the file, library, and object type of the file I am interested in. Line I fetch the results from the cursor, same number of rows as there are elements in the data structure array Jobs. Lines 22 - If I did not retrieve any results, in other words there are no jobs locking the file, I quit the program.

Line 25 — This is the section of code where I end all the jobs that have this file locked. Line I am using a For group to loop through the data structure array, for the same number of times as rows were retrieved in the cursor's fetched results.

It is as simple as I have shown, when this program has finished all jobs that were locking the file have been ended. This article was written for IBM i 7. Hi Simon, Is there a way to know the specific program that is locking a file without having to look at the source of programs in the call stack?

Alas, the only way I know is to go to the program stack. Are you doing that using SQL, if not check it out here. Simon, thanks for sharing. Another very helpful tool.

Great read and examples.. Thank you Simon! If someone has a file locked, but not a record, then it will not appear in the results. To prevent "comment spam" all comments are moderated. Learn about this website's comments policy here. Some people have reported that they cannot post a comment using certain computers and browsers. If this is you feel free to use the Contact Form to send me the comment and I will post it for you, please include the title of the post so I know which one to post the comment to.

Another job may read the record, but cannot lock it for update until the original lock is released. For a short time the operating system holds an internal lock to access the record. Another job can read the record and may even have the record locked for update. If another job does hold the row locked for update the change of the record will not proceed until the internal lock is released.

Labels: programming , sql. Glenn Gundermann January 6, at AM. Dan Lovell January 7, at AM. Unknown January 13, at PM. Simon Hutchinson January 13, at PM. Recently, I was asked to work on a program that had locked itself out of a database record. An RPG program accessed one physical file through three access paths—the physical file itself and two logical files that were built over the physical file.

The program screeched to a halt when a record that had been read and locked for update through one access path was requested to be read for update through another access path.

I wrote a short demo program to illustrate this situation. The first chain succeeds, but the IF that follows the chain fails because customer in company 1 does not have a class code of Imagine a lot of calculations taking place, until finally the second chain attempts to retrieve the same record by customer name.



0コメント

  • 1000 / 1000