ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Locking a record during an update on a chain.

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

  • Locking a record during an update on a chain.

    How do I exclusive lock a record when I chain to a record to update the fields?

    Code:

    BegSr SUpdate;
    Chain SIPROD IIMXX1;
    If %found(IIMXX1);

    I want to exclusive lock the record if I find the record.

    Does anyone have an example.

    Thanks,

    DAC

  • #2
    Re: Locking a record during an update on a chain.

    DAC,

    If you have a 'U' in your F spec, you should have an exclusive lock.

    HTH,
    MdnghtPgmr
    "Tis better to be thought a fool then to open one's mouth and remove all doubt." - Benjamin Franklin

    Comment


    • #3
      Re: Locking a record during an update on a chain.

      Originally posted by dcutaia
      How do I exclusive lock a record when I chain to a record to update the fields?

      Code:

      BegSr SUpdate;
      Chain SIPROD IIMXX1;
      If %found(IIMXX1);

      I want to exclusive lock the record if I find the record.

      Does anyone have an example.

      Thanks,

      DAC
      That will do it. If you chain to an update file, you will get an exclusive lock on the record if it is found.
      Michael Catalani
      IS Director, eCommerce & Web Development
      Acceptance Insurance Corporation
      www.AcceptanceInsurance.com
      www.ProvatoSys.com

      Comment


      • #4
        Re: Locking a record during an update on a chain.

        Keep in mind if another program is running but doesn't open the file for update it will still be able to chain and read the record from the file.

        Only programs that also have the file defined as an Update file (have a "U" in the F-Spec) will be locked out of chaining and locking the record while your program holds the "exclusive" record lock.

        Comment

        Working...
        X