ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Reg : Record Lock

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

  • Reg : Record Lock

    Hi all

    I declared file in only for read mode. i am not doing any update statement

    Using chain function, i am reading another file with key. at the time the file get lock.

    this situation what i have to do?

    Thanx a lot
    magesh

  • #2
    Re: Reg : Record Lock

    What file did you declare for read mode and which file is being locked? Are they the same file?
    Your future President
    Bryce

    ---------------------------------------------
    http://www.bravobryce.com

    Comment


    • #3
      Re: Reg : Record Lock

      Hi kmkmagesh:

      If file2 is a logical over file1 the record used for update in file2 will be locked in file1 and any other logocal over file1.
      If this is not the case I expect another job is locking file1.

      Best of Luck
      GLS
      Last edited by GLS400; September 14, 2007, 07:56 AM.
      The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

      Comment


      • #4
        Re: Reg : Record Lock

        Hi

        I declared one Temporary file (fileA), some filter condition I am inserting into that PF, the same file (fileA) I am reading from (fileA) then the file get lock. the file (fileA) is a physical file that file having key field.

        Each time I am clearing the file and write some data.

        I am not doing any update statement

        DZSAPP IF A E K DISK USROPN

        Thanx in advance
        magesh

        Comment


        • #5
          Re: Reg : Record Lock

          Adding records to a file is updates the file.

          Comment


          • #6
            Re: Reg : Record Lock

            You still need to do something like this.....

            yourkey chain (N) fileA


            The (N) means that it will not lock the file. Do this only where you want to read something from the file. Then you won't get the record lock when reading.



            ps...
            DZSAPP IF A E K DISK USROPN
            it needs to be UF not IF, even if you are not 'updating', like RCKASS said, Appending records is still updating the file.
            Your future President
            Bryce

            ---------------------------------------------
            http://www.bravobryce.com

            Comment


            • #7
              Re: Reg : Record Lock

              Hi

              Is it necessary that i have to give chain(n) ?

              in file spec I decleared only 'I' not 'U'.

              Thanx a lot
              magesh

              Comment


              • #8
                Re: Reg : Record Lock

                Pls paste here the meaningful excerpt of your program I-O code to help us seize your issue.
                Philippe

                Comment


                • #9
                  Re: Reg : Record Lock

                  sure i will post

                  Comment


                  • #10
                    Re: Reg : Record Lock

                    Hi kmkmagesh:

                    Use the UNLOCK opcode.

                    Code:
                    UNLOCK    FILE1
                    Best of Luck
                    GLS
                    The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

                    Comment


                    • #11
                      Re: Reg : Record Lock

                      Originally posted by kmkmagesh View Post
                      Hi

                      Is it necessary that i have to give chain(n) ?

                      in file spec I decleared only 'I' not 'U'.

                      Thanx a lot
                      magesh
                      Magesh,

                      You have declared your file as input, But you have an 'A' in the file addition field (which means you want to allow writes to the file)

                      i.e.

                      Code:
                      DZSAPP IF [B]A[/B] E K DISK USROPN
                      This may give you a lock on the file.

                      Mike
                      You don't stop playing games because you get old, You get old because you stop playing games!

                      Comment


                      • #12
                        Re: Reg : Record Lock

                        But the real problem is that he actually wants to write to the file. So he needs to make it a UF not IF. Leave the A there and then just use Chain (N). This isn't rocket science, its RPG for crying out loud.
                        Your future President
                        Bryce

                        ---------------------------------------------
                        http://www.bravobryce.com

                        Comment


                        • #13
                          Re: Reg : Record Lock

                          Originally posted by bryce4president View Post
                          But the real problem is that he actually wants to write to the file. So he needs to make it a UF not IF. Leave the A there and then just use Chain (N). This isn't rocket science, its RPG for crying out loud.
                          well, to write to a file he has declared it correctly, IF with an A. (or an O is fine too)
                          It is not UF. UF is for updates or deletes only.

                          Comment


                          • #14
                            Re: Reg : Record Lock

                            so, kmk, does either the UF or CHAIN(N) help ?

                            sure i will post
                            this would help a lot, I think.

                            Comment


                            • #15
                              Re: Reg : Record Lock

                              Hi

                              Thanx a lot i used UNLOCK.

                              Thanx a lot
                              magesh

                              Comment

                              Working...
                              X