BookmarkSubscribeRSS Feed
GTickner
Obsidian | Level 7

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?

7 REPLIES 7
art297
Opal | Level 21

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

GTickner
Obsidian | Level 7

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

Reeza
Super User

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.

GTickner
Obsidian | Level 7

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.

Reeza
Super User

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.

Doc_Duke
Rhodochrosite | Level 12

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

GTickner
Obsidian | Level 7

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 1790 views
  • 0 likes
  • 4 in conversation