Random Access files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Oin Zea

    Random Access files

    Is it possible for to program to access a random file at the same time and
    perform actions like create a new record?



  • J French

    #2
    Re: Random Access files

    On Mon, 7 Jun 2004 19:21:27 -0700, "Oin Zea" <OinZea@hotmail .com>
    wrote:
    [color=blue]
    >Is it possible for to program to access a random file at the same time and
    >perform actions like create a new record?[/color]

    Er... could you clarify your question ?


    Comment

    • Steve Gerrard

      #3
      Re: Random Access files


      "J French" <erewhon@nowher e.com> wrote in message
      news:40c535b9.7 [email protected] click.com...[color=blue]
      > On Mon, 7 Jun 2004 19:21:27 -0700, "Oin Zea" <OinZea@hotmail .com>
      > wrote:
      >[color=green]
      > >Is it possible for to program to access a random file at the same[/color][/color]
      time and[color=blue][color=green]
      > >perform actions like create a new record?[/color]
      >
      > Er... could you clarify your question ?
      >
      >[/color]

      I think the OP is asking:

      Can two programs or users open the same file For Random access at the
      same time, and both perform write and append operations?

      If so, I think the answer is yes, but I don't have any experience with
      this.


      Comment

      • J French

        #4
        Re: Random Access files

        On Mon, 7 Jun 2004 22:12:15 -0700, "Steve Gerrard"
        <notstevegerrar [email protected]> wrote:
        [color=blue]
        >
        >"J French" <erewhon@nowher e.com> wrote in message
        >news:40c535b9. [email protected] tclick.com...[color=green]
        >> On Mon, 7 Jun 2004 19:21:27 -0700, "Oin Zea" <OinZea@hotmail .com>
        >> wrote:
        >>[color=darkred]
        >> >Is it possible for to program to access a random file at the same[/color][/color]
        >time and[color=green][color=darkred]
        >> >perform actions like create a new record?[/color]
        >>
        >> Er... could you clarify your question ?
        >>
        >>[/color]
        >
        >I think the OP is asking:
        >
        >Can two programs or users open the same file For Random access at the
        >same time, and both perform write and append operations?
        >
        >If so, I think the answer is yes, but I don't have any experience with
        >this.[/color]

        Ah - thanks Steve - I was genuinely bemused

        Yes, two Apps can attack the same Random Access file at the same time.
        They can both increase its length, but I would be very wary of doing
        this as I am pretty sure that the LOF() function of one instance will
        not know what the other instance has been up to.

        Years ago I did a load of tests on this on a Novel network and found
        that sometimes adjacent records got overwritten, also about eight
        hours after running the tests, the Network would crash horribly.

        The APIs still support locking ranges/regions of a File.

        If I had to do this, then I would use a pre-extended file and have a
        kind of 'logical' locking system in the first few records.

        Comment

        • Oin Zea

          #5
          Re: Random Access files

          So I French, what will you suggest me do? what I need done is for 3 to 4
          computers to access a client file in real-time. all pc can create, edit, and
          delete clients from that file.

          "J French" <erewhon@nowher e.com> wrote in message
          news:40c55619.8 [email protected] click.com...[color=blue]
          > On Mon, 7 Jun 2004 22:12:15 -0700, "Steve Gerrard"
          > <notstevegerrar [email protected]> wrote:
          >[color=green]
          > >
          > >"J French" <erewhon@nowher e.com> wrote in message
          > >news:40c535b9. [email protected] tclick.com...[color=darkred]
          > >> On Mon, 7 Jun 2004 19:21:27 -0700, "Oin Zea" <OinZea@hotmail .com>
          > >> wrote:
          > >>
          > >> >Is it possible for to program to access a random file at the same[/color]
          > >time and[color=darkred]
          > >> >perform actions like create a new record?
          > >>
          > >> Er... could you clarify your question ?
          > >>
          > >>[/color]
          > >
          > >I think the OP is asking:
          > >
          > >Can two programs or users open the same file For Random access at the
          > >same time, and both perform write and append operations?
          > >
          > >If so, I think the answer is yes, but I don't have any experience with
          > >this.[/color]
          >
          > Ah - thanks Steve - I was genuinely bemused
          >
          > Yes, two Apps can attack the same Random Access file at the same time.
          > They can both increase its length, but I would be very wary of doing
          > this as I am pretty sure that the LOF() function of one instance will
          > not know what the other instance has been up to.
          >
          > Years ago I did a load of tests on this on a Novel network and found
          > that sometimes adjacent records got overwritten, also about eight
          > hours after running the tests, the Network would crash horribly.
          >
          > The APIs still support locking ranges/regions of a File.
          >
          > If I had to do this, then I would use a pre-extended file and have a
          > kind of 'logical' locking system in the first few records.[/color]



          Comment

          • Bob Butler

            #6
            Re: Random Access files

            "Oin Zea" <OinZea@hotmail .com> wrote in message news:<tbhxc.217 0$Jz6.335@fe39. usenetserver.co m>...[color=blue]
            > So I French, what will you suggest me do? what I need done is for 3 to 4
            > computers to access a client file in real-time. all pc can create, edit, and
            > delete clients from that file.[/color]

            can you use a database instead of a flat file?

            can you use an ActiveX EXE server on the PC with the file and call
            methods in that to coordinate updating the local file?

            can you implement a locking mechanism (e.g. open another file
            exclusively when you want to update)?

            Comment

            • Oin Zea

              #7
              Re: Random Access files

              I can use any of them, provided you tell me how. if you can.

              "Bob Butler" <butlerbob@eart hlink.net> wrote in message
              news:fa10fb0.04 06081249.27ba76 [email protected] e.com...[color=blue]
              > "Oin Zea" <OinZea@hotmail .com> wrote in message[/color]
              news:<tbhxc.217 0$Jz6.335@fe39. usenetserver.co m>...[color=blue][color=green]
              > > So I French, what will you suggest me do? what I need done is for 3 to 4
              > > computers to access a client file in real-time. all pc can create, edit,[/color][/color]
              and[color=blue][color=green]
              > > delete clients from that file.[/color]
              >
              > can you use a database instead of a flat file?
              >
              > can you use an ActiveX EXE server on the PC with the file and call
              > methods in that to coordinate updating the local file?
              >
              > can you implement a locking mechanism (e.g. open another file
              > exclusively when you want to update)?[/color]



              Comment

              • J French

                #8
                Re: Random Access files

                On Tue, 8 Jun 2004 07:15:08 -0700, "Oin Zea" <OinZea@hotmail .com>
                wrote:
                [color=blue]
                >So I French, what will you suggest me do? what I need done is for 3 to 4
                >computers to access a client file in real-time. all pc can create, edit, and
                >delete clients from that file.[/color]

                Ok,
                The really safe way is to open the file in 'lock write' mode before
                every update, then close it after the update

                The time hit will not be that great.

                If you really want to keep the file open, then I suggest that you
                pre-format it
                - eg: write loads of blank records so that the file is never extended
                during normal use
                This means that the FAT info and the important directory info will not
                change.

                I would also have a status field in each record,
                eg: unused, locked, etc
                Also: store the update person and DateTime in each record

                Then use another file that you open in deny write mode, write in the
                name of the updater, then 'lock' the individual record that a user is
                going to update. It then closes the deny write file.

                That is what we called the 'Block-Lock' approach

                The effect is that a user goes to a record and sees:
                'Record XXXXX is in use by User YYYYYY'

                You need to be incredibly careful when adding records, as there must
                be no possibility of one user overwriting a new record.
                I would do that while the system is 'Blocked'

                Anyway - the general idea is that a separate file is physically locked
                to act as a semaphore for all the other users.

                I would suggest that you experiment with locking files and watching
                multiple processes contesting for access.


                Comment

                Working...