BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi, we create a lot of excel and text files that are picked up by users. From time to time someone will have the file open when we are trying to overwrite it, which generates the following error in the log :
ERROR: File is in use, \\svrbu3file\etc........

I'm looking for a way of trapping this error and doing something in the code when it occurs. I tried checking syscc but it is still 0. Has anyone else had this problem or anyone able to offer a suggestion?

Thanks.
2 REPLIES 2
deleted_user
Not applicable
Further investigation shows a proc export will set the syscc to 1012 however when using ods syscc is still 0.

Naturally it is ods that we are using 😞

So if you know a way to check a file in use when creating a file using ods .... 🙂
DanielSantos
Barite | Level 11
Try to open the file through the external file functions, for example like this:

%let FILENAME=D:\temp\Teste.xls;
data _null_;
RC=filename('MYFILE',"&FILENAME");
FID=fopen('MYFILE','I');
if not FID then put "File &FILENAME is in use!";
else put "File &FILENAME opened successfully.";
RC=fclose(FID);
run;

FOPEN functions returns a file identifier (non zero integer) if the file was opened successfully.

See more on this here:
http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a000209683.htm

Cheers from Portugal.

Daniel Santos @ www.cgd.pt.

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2 replies
  • 1699 views
  • 1 like
  • 2 in conversation