1

Suppose I want to update a record , but that record is being locked by some other application or program , what can be done to make sure that I can update that record in the next iteration?

Kunal Roy
  • 729
  • 3
  • 11
  • You're a very frequent poster lately and I get the impression you're abusing Stackoverflow helpers to do your homework instead you taking your time and learn system and SQL basics from the actual documentation provided by IBM. Stack Exchange is meant as a last resort, and not a free Q&A game. There is a reason that a question should include some proof that you tried to resolve the issue on your own but got stuck. – PoC Jul 10 '22 at 09:42

3 Answers3

1

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.

Rob Schember
  • 206
  • 1
  • 3
0

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

PoC
  • 521
  • 3
  • 13
0

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.

RockBoro
  • 2,163
  • 2
  • 18
  • 34