469,106 Members | 2,135 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,106 developers. It's quick & easy.

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?

Jul 17 '05 #1
7 6816
On Mon, 7 Jun 2004 19:21:27 -0700, "Oin Zea" <Oi****@hotmail.com>
wrote:
Is it possible for to program to access a random file at the same time and
perform actions like create a new record?


Er... could you clarify your question ?
Jul 17 '05 #2

"J French" <er*****@nowhere.com> wrote in message
news:40***************@news.btclick.com...
On Mon, 7 Jun 2004 19:21:27 -0700, "Oin Zea" <Oi****@hotmail.com>
wrote:
Is it possible for to program to access a random file at the same time andperform actions like create a new record?


Er... could you clarify your question ?


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.
Jul 17 '05 #3
On Mon, 7 Jun 2004 22:12:15 -0700, "Steve Gerrard"
<no*************@comcast.net> wrote:

"J French" <er*****@nowhere.com> wrote in message
news:40***************@news.btclick.com...
On Mon, 7 Jun 2004 19:21:27 -0700, "Oin Zea" <Oi****@hotmail.com>
wrote:
>Is it possible for to program to access a random file at the sametime and >perform actions like create a new record?


Er... could you clarify your question ?


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.


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.
Jul 17 '05 #4
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" <er*****@nowhere.com> wrote in message
news:40***************@news.btclick.com...
On Mon, 7 Jun 2004 22:12:15 -0700, "Steve Gerrard"
<no*************@comcast.net> wrote:

"J French" <er*****@nowhere.com> wrote in message
news:40***************@news.btclick.com...
On Mon, 7 Jun 2004 19:21:27 -0700, "Oin Zea" <Oi****@hotmail.com>
wrote:

>Is it possible for to program to access a random file at the same

time and
>perform actions like create a new record?

Er... could you clarify your question ?


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.


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.


Jul 17 '05 #5
"Oin Zea" <Oi****@hotmail.com> wrote in message news:<tb****************@fe39.usenetserver.com>...
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.


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)?
Jul 17 '05 #6
I can use any of them, provided you tell me how. if you can.

"Bob Butler" <bu*******@earthlink.net> wrote in message
news:fa************************@posting.google.com ...
"Oin Zea" <Oi****@hotmail.com> wrote in message

news:<tb****************@fe39.usenetserver.com>...
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.


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)?


Jul 17 '05 #7
On Tue, 8 Jun 2004 07:15:08 -0700, "Oin Zea" <Oi****@hotmail.com>
wrote:
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.


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.
Jul 17 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by greeningster | last post: by
3 posts views Thread by Cybertof | last post: by
1 post views Thread by Patrick | last post: by
3 posts views Thread by Simon | last post: by
13 posts views Thread by Stuart | last post: by
16 posts views Thread by Claudio Grondi | last post: by
39 posts views Thread by Alan Isaac | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.