Open read-only?
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
Open read-only?
Is it possible to open databases and workfiles read-only? If not, is this something you might consider including?
-
EViews Chris
- EViews Developer
- Posts: 161
- Joined: Wed Sep 17, 2008 10:39 am
Re: Open read-only?
I'm not sure exactly what you have in mind here.
EViews uses read-only file handles whenever it reads from a database or workfile, and read-write file handles when it writes to a database/workfile.
This means that you are able to set read only permissions on files at the operating system level (including by user, where available) and that would stop either all users or a selected group of users writing to the file.
You can also toggle these file permissions from within an EViews program using a DOS command:
shell attrib +r myfile.wf1
makes the file read only.
shell attrib -r myfile.wf1
makes it writeable again.
Is there something else you have in mind?
EViews uses read-only file handles whenever it reads from a database or workfile, and read-write file handles when it writes to a database/workfile.
This means that you are able to set read only permissions on files at the operating system level (including by user, where available) and that would stop either all users or a selected group of users writing to the file.
You can also toggle these file permissions from within an EViews program using a DOS command:
shell attrib +r myfile.wf1
makes the file read only.
shell attrib -r myfile.wf1
makes it writeable again.
Is there something else you have in mind?
-
EViews Chris
- EViews Developer
- Posts: 161
- Joined: Wed Sep 17, 2008 10:39 am
Re: Open read-only?
I should add that for and EViews database, setting the permissions on the file with the .edb extension should be sufficient.
Re: Open read-only?
I see now that it works just fine setting the file permissions to read-only with databases. However, with workfiles this does not help me. I would like to not be able to alter a workfile when it is read-only. And have some syntax enabling me to open a file as read-only, even if the file permissions are not set to read-only.
The code below disregards that the workfile is read-only. Thus the second series (tmp2) is created in the final row, eventhough that row should return an error.
The code below disregards that the workfile is read-only. Thus the second series (tmp2) is created in the final row, eventhough that row should return an error.
Code: Select all
wfcreate a 1980 2012
series tmp=0
wfsave c:\temp\test.wf1
close @all
shell attrib +r c:\temp\test.wf1
wfopen c:\temp\test.wf1
series tmp2=0-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Open read-only?
You will be unable to save the workfile though, so the version on disk will remain unchanged.
Who is online
Users browsing this forum: No registered users and 2 guests
