ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Command to check a LOCKED record/data

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

  • Command to check a LOCKED record/data

    Hi,

    I'm now in my first project using RPG.
    This is my first email too.
    Before this I tried to send this email by replying other email.
    So Sorry for the uncomfortable.

    I have problem to tell other user that the record/data they want to use is locked by other user.

    The concept of the program is display 10 records using subfile. User can mark a data/record to see the detail of the record (using record).
    While the record is used by a user, this record should not be accessed by other user (other user cannot see the detail of the data).
    How to check that the record is used by other user and display a message to the other user who access the record that the record is used by other user.

    Thanks for your help.


    Best regards,
    TWongW

  • #2
    Re: Command to check a LOCKED record/data

    Hi TWongW

    For that particular file, use INFSR & INFDS. You can find if a record is locked by using the status from FIle Information Data Structure. If the status is 1018...(I am not sure), then the record is locked. and through INFSR, you can pass a message to the user. Hope this helps.
    Cheers
    PKBUNU

    Comment


    • #3
      Re: Command to check a LOCKED record/data

      Code:
           FMBADREPL02UF   E           K Disk    InfDS(ADL02DS)  
           F   
           DADL02DS          DS
           D  L02Status        *Status
           D 
           C                   Read(N)   MBADREPL02                     
           C                   If        L02Status = 1218
           C*    send your message ...
           C                   EndIf

      Comment


      • #4
        Re: Command to check a LOCKED record/data

        Hey arrow, interesting, I thought that if you use (N) you are saying to not record lock. So i just assumed that you would not even get a record lock status. I'll try this when i get it.
        Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

        Comment


        • #5
          Re: Command to check a LOCKED record/data

          The (N) tells the read not to lock the record in this program.
          The If L02Status = 1218 checks to see if another program has the record locked.
          Bill
          "A good friend will bail you out of jail,
          A true friend would be sitting beside you saying,
          'Wow, that was fun.'"

          Comment


          • #6
            Re: Command to check a LOCKED record/data

            Hi All,

            Thank's for all your helps.
            The problem has been done.

            I changed the PF & LF configuration using 'CHGPF & CHGLF', change the 'Maximum File Wait Time' and 'Maximum Record Wait Time' To '*IMMED'.
            Using operation code 'ReadE(E)' to check the status of the record.
            If %Error
            Display Message
            EndIf


            Best regards,
            TWongW

            Comment

            Working...
            X