ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Determine RRN of record lock when using E extender on a Read or Chain

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Determine RRN of record lock when using E extender on a Read or Chain

    Is there any way to determine what RRN is being locked on a Read(E) or Chain(E). In this situation there is nothing in the INFDS or job log to retrieve. Doing a SetLL prior to read or chain would work but I would prefer not to use that method if possible.

  • #2
    It is in the I/O feedback portion of the INFDS - an Uns(10) field at position 397. Are you not seeing a value there?

    Comment


    • #3
      I am already checking that position. That info in the INFDS is not updated due to the lock.

      Comment


      • JonBoy
        JonBoy commented
        Editing a comment
        Sorry - I apparently mis-understood what you were asking. I thought you were asking how to tell which record you had just locked.

    • #4
      FWIW, I always do something like this:
      Code:
      Read(e) PF gDataStructure;
      If %error();
        Read(n) PF gDataStructure;
        RcdLck();  // DIY procedure for handling
      Endif;
      HTH

      Comment


      • jtaylor___
        jtaylor___ commented
        Editing a comment
        The no-lock input gets me the RRN of the locked row.

      • JonBoy
        JonBoy commented
        Editing a comment
        Excellent solution - I really like that approach.

    • #5
      I think you nailed it. Didn't even think of trying that. I have been trying to make the code after the %error as generic as possible so I could just plug it in when ever needed.

      Comment


      • jtaylor___
        jtaylor___ commented
        Editing a comment
        My RcdLck() is a procedure in a service program. It has parameters to identify what table/row is locked. I omitted those from my example because I was typing that code from memory.
    Working...
    X