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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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