ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Locked record not released after operation code UPDATE

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

  • Locked record not released after operation code UPDATE

    As we know that for Update File, perform chain or read will locked the record. However, after we perform the updating, should the job release the lock or keep locking until we seton LR, close file, unlock or commit?

    I face this problem that the job didn't release the record lock although I had performed update operation.

  • #2
    Re: Locked record not released after operation code UPDATE

    Originally posted by colourwolf82 View Post
    ...However, after we perform the updating, should the job release the lock or keep locking until we seton LR, close file, unlock or commit?
    Also after an except, write or reading/chaining to another record.

    Yes, it should.
    Regards

    Kit
    http://www.ecofitonline.com
    DeskfIT - ChangefIT - XrefIT
    ___________________________________
    There are only 3 kinds of people -
    Those that can count and those that can't.

    Comment


    • #3
      Re: Locked record not released after operation code UPDATE

      Not sure, what your problem is.

      If you are working under commitment control a locked record will be only released by the next commit or rollback. Unlock or (N) will not release a record locked under commitment control.

      Birgitta

      Comment


      • #4
        Re: Locked record not released after operation code UPDATE

        Hi,

        If the record want to be unlocked user Read (N) in rpgiv or in cobol/400 use read with no lock.

        Thanks
        hsp
        'Coding = Experience'
        hsp

        Comment


        • #5
          Re: Locked record not released after operation code UPDATE

          Or you have reread or chained the record again (after update)
          Tip: If you load a subfile, read the records with a READ(n)

          Comment


          • #6
            Re: Locked record not released after operation code UPDATE

            ... but keep in mind!
            If you work with commitment control neither UNLOCK nor (N) will release a read and updated record. ONLY Commit or Rollback will release it!

            Birgitta

            Comment


            • #7
              Re: Locked record not released after operation code UPDATE

              Originally posted by colourwolf82 View Post
              I face this problem that the job didn't release the record lock although I had performed update operation.
              Are you SURE that the update opcode was processed? One common mistake with holding locked records in maintenance programs is that the user presses F12 (pages back) from the update screen, because they dont want to update the record. The program had locked the record, and had the user actually processed the update, then the record is released. But if the user pages back without updating, then the update opcode may not be processed and the lock is held. You have to issue an unlock or some other lock releasing opcode in order to release the lock.

              Like Birgitta also said, if you are under committment control, you will either need to commit the changes or roll them back before the lock is released.
              Michael Catalani
              IS Director, eCommerce & Web Development
              Acceptance Insurance Corporation
              www.AcceptanceInsurance.com
              www.ProvatoSys.com

              Comment


              • #8
                Re: Locked record not released after operation code UPDATE

                Originally posted by colourwolf82
                As we know that for Update File, perform chain or read will locked the record.
                Read does not lock the record.
                If the record is locked by a previous update stm the read will wait until the record is released or the database wait record time reached.

                Just to add my 2cts today.
                Philippe

                Comment


                • #9
                  Re: Locked record not released after operation code UPDATE

                  Originally posted by colourwolf82
                  As we know that for Update File, perform chain or read will locked the record.
                  Read does not lock the record.
                  If the record is locked by a previous update stm the read will wait until the record is released or the database wait record time reached.

                  Just to add my 2cts today.
                  Philippe

                  Comment


                  • #10
                    Re: Locked record not released after operation code UPDATE

                    If the file is defined as update file, a READ or CHAIN WILL LOCK the record.

                    It will only wait if the record is already locked by an other job or program.

                    Birgitta

                    Comment


                    • #11
                      Re: Locked record not released after operation code UPDATE

                      Oops, I'm really getting too old. I'm way, way out. I'd have better to quit after a hard work today.
                      Philippe

                      Comment


                      • #12
                        Re: Locked record not released after operation code UPDATE

                        Thanks for all the advise above. I has done a testing, so can make a conclusion that if the File A is under commitment control, after we update a locked record from File A, need to wait until commint or rollback then only the job will release the record.

                        However, if the File A is not under commitment control, job will release the locked record directly after we update the locked record from File A.

                        Comment

                        Working...
                        X