The SAS Output Delivery System and reporting techniques

"File is in use" when creating ODS HTML

Reply
Contributor
Posts: 20

"File is in use" when creating ODS HTML

A scheduled job creates an ODS HTML file with a table of contents five times daily, with the following error occurring 11 times over the last 150 executions:

     "ERROR: File is in use"

pointing to the HTML body file. If I re-run the report, the file is usually (but not always) open for write by the time I detect the error. There's at least 35 minutes between any two executions.

The destination directory (Windows XP) is restricted to read-only for all clients, so I suspect that my report job might be the culprit. Any idea as to how SAS might be leaving a file open, or why ODS HTML CLOSE wouldn't assure a close? Or should I suspect something else?

PROC Star
Posts: 7,468

"File is in use" when creating ODS HTML

You didn't mention which version of SAS you were using thus the following may or may not be relevant: http://support.sas.com/kb/8/565.html

Contributor
Posts: 20

"File is in use" when creating ODS HTML

I'm using SAS 9.2 under Windows XP. I had seen the reference, but it appears relevant to Z/OS only?

Super User
Posts: 19,772

"File is in use" when creating ODS HTML

I might be misunderstanding, but are you trying to write the same file the that is a 'read only' for clients?

Even if someone didn't have write access having a file open in read only would cause issues for SAS I'd guess.

Ideally you should be creating the file somewhere then calling a second job that copies the relevant files to the read only location probably using X commands upon successful completion of the first file.

Contributor
Posts: 20

"File is in use" when creating ODS HTML

The directory in which the file resides is read-only for clients (to prevent them from locking the file), but I have full control. 93% of the time, my scheduled job rewrites the file without problem.

Your idea of creating a local copy and copying to the public location might be a good one for more than one reason, but I don't see how it solves the problem of the file lock. If something in SAS is locking the file (and I don't know where else it comes from), then the lock will affect the local copy. If it's a network problem, then COPYFILE will be affected.

Thanks, though; it gives me something to try.

Super User
Posts: 19,772

"File is in use" when creating ODS HTML

I created a file using the following code:

ods html file='C:\temp.html' style=meadow;

proc print data=sashelp.class;

run;

ods html close;

I then opened the file in Read Only mode and tried to re-run my SAS code and got the same error.

AFAIK SAS can't replace the file while its open so someone has the file open when you're trying to rewrite the file.

Not sure about the windows system process.

Trusted Advisor
Posts: 2,115

"File is in use" when creating ODS HTML

Reeza nailed it.  SAS checks for the file being open, not they type of openness.

Contributor
Posts: 20

"File is in use" when creating ODS HTML

Not so -- I update the file while it is being read through multiple browsers. Some applications (e.g., MS/Word) will put an exclusive hold on the file -- if they are permitted. For that reason, I make the directory read-only for my users. If they try to open it with MS/Word, it opens read-only.

Ask a Question
Discussion stats
  • 7 replies
  • 429 views
  • 0 likes
  • 4 in conversation