How to eliminate an error message?

castrorafa

New Member
I have this portion of code in PROGRESS 9.1c:

=============================================
DO ON ERROR UNDO:
OUTPUT TO bitacora.LOG APPEND.
PUT "Hello World".
OUTPUT CLOSE.
END.
MESSAGE "The program continues..." VIEW-AS ALERT-BOX.
=============================================


When the file bitacora.LOG is read-only or Progress cannot access the file for any reason. I Get this message:
Unable to open file: bitacora.log

I would like to know how to avoid this message.​

Any suggestions?​

Thanks a lot..​
 

StuartT

Member
The best way to handle this is to ensure the file has write access on it.
On unix based systems the main cause of these types of errors is a users UMASK being set incorrectly to only grant write access to the owner and read to others. it is best to get this set up correctly for users.
 

rstanciu

Member
fileName = "bitacora.LOG".
lc = SEARCH VALUE(fileName).
IF lc = ? THEN ... not found !
ELSE DO:
FILE-INFO:FILE-NAME = lc.
IF FILE-INFO:FILE-TYPE NE "W" THEN ... you can not write the file !
END.
 

LarryD

Active Member
If the OS is unix/linux, the umask can fix this.

However, you can also do this programatically to allow all users to append to the log by doing the following:

if search("bitocora.LOG") = ?
then do:
output to value("bitocora.LOG").
output close.
os-command silent value( "chmod 666 bitocora.LOG").
end.
output to value("bitocora.LOG") APPEND.
 
Top