SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
FileExists Problem

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
FileExists Problem
Author Message
Brent



Joined: 20 Feb 2002
Posts: 57

Post FileExists Problem Reply with quote

It appears that the FileExists command does not see
a file as locked when the file is locked by another
process in 24x7. As a result, the process needing
the file cannot access the file. Could one of the
following be done:

1. Could the FileExists be changed to detect a locked
file by another process in 24x7?

2. Is there a way to lock the file so that the
FileExists command can see that it is locked in another
24x7 process? I noticed that the FileOpen has a
filelock argument that is not explained.

If anything, please update the documentation to be
clear about this problem with FileExists.

Fri Nov 14, 2003 12:59 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7969

Post Re: FileExists Problem Reply with quote

FileExists is used to check file existance, why should it be used to check file locking state?

You can alsways test for lock state if you attempt to open it with FileOpen statement. If that operation fails then the file is locked, on success just close the file.

Here is how

Dim locked, boolean, TRUE
Dim file_number, number
OnErrorGoto AFTER_CHECK
FileOpen "my file", "StreamMode", "Read", "", file_number
Set locked, FALSE
FileClose file_number

AFTER_CHECK:
OnErrorStop

// now you know whether it is locked or not
MessageBox locked

: It appears that the FileExists command does not see
: a file as locked when the file is locked by another
: process in 24x7. As a result, the process needing
: the file cannot access the file. Could one of the
: following be done: 1. Could the FileExists be changed to detect a locked
: file by another process in 24x7?

: 2. Is there a way to lock the file so that the
: FileExists command can see that it is locked in another
: 24x7 process? I noticed that the FileOpen has a
: filelock argument that is not explained.

: If anything, please update the documentation to be
: clear about this problem with FileExists.

Fri Nov 14, 2003 2:13 pm View user's profile Send private message
Brent



Joined: 20 Feb 2002
Posts: 57

Post Re: FileExists Problem Reply with quote

Okay, I think I understand what you are saying. Could you
explain what the filelock argument to the FileOpen command
does? I think it would be helpful to understand what this
argument does. Thank you.

: FileExists is used to check file existance, why should it be used to check
: file locking state?

: You can alsways test for lock state if you attempt to open it with FileOpen
: statement. If that operation fails then the file is locked, on success
: just close the file.

: Here is how

: Dim locked, boolean, TRUE
: Dim file_number, number
: OnErrorGoto AFTER_CHECK
: FileOpen "my file", "StreamMode", "Read",
: "", file_number
: Set locked, FALSE
: FileClose file_number

: AFTER_CHECK: OnErrorStop

: // now you know whether it is locked or not
: MessageBox locked

Tue Nov 25, 2003 4:50 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7969

Post Re: FileExists Problem Reply with quote

File locking provides a very simple yet useful mechanism for coordinating file accesses.

Locking mode is usually specified at the time of file openning. The lock mode controls whether others users (or programs if you want) have access to the opened file.

Most common modes are:
Lock Read/Write — Only the user who opened the file has access.
Lock Read — Only the user who opened the file can read it, but everyone has write access.
Lock Write — Only the user who opened the file can write to it, but everyone has read access·
Shared — All users have read and write access (in other words no hard locking)

: Okay, I think I understand what you are saying. Could you
: explain what the filelock argument to the FileOpen command
: does? I think it would be helpful to understand what this
: argument does. Thank you.

Wed Nov 26, 2003 12:09 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.