简体   繁体   中英

What can be done if we want to update a record locked by other program or application in RPGLE

假设我想更新一条记录,但该记录被其他应用程序或程序锁定,可以做些什么来确保我可以在下一次迭代中更新该记录?

Nothing. A lock is issued by another application and that application needs to free it.

The rule to follow is that record locks should never be retained during key think time . That is the job should have no record locks when it runs the exfmt statement to write the display format and wait for the user to press the enter key. This includes any updates which have not yet been committed when running under commitment control. Always run SQL COMMIT before a blocking DSPF read.

If this program was running in batch and it was critical that the record in question gets updated, you could use the (E) extender on your Chain and monitor for the %Error. Something like this:

// This record MUST be updated
Dou %Error = *Off;
  Chain(E) (FileKey) CriticalFile
Enddo;

// At this point, we've gotten past the file lock
If %Found(CriticalFile);
  Update CriticalFileRec;
Endif;

The Do-Until will continuously loop until a successful chain is achieved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM