<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Detecting an existing lock on external output file in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Detecting-an-existing-lock-on-external-output-file/m-p/60675#M17214</link>
    <description>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 :&lt;BR /&gt;
ERROR: File is in use, \\svrbu3file\etc........&lt;BR /&gt;
&lt;BR /&gt;
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?&lt;BR /&gt;
&lt;BR /&gt;
Thanks.</description>
    <pubDate>Fri, 31 Jul 2009 06:01:37 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-07-31T06:01:37Z</dc:date>
    <item>
      <title>Detecting an existing lock on external output file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Detecting-an-existing-lock-on-external-output-file/m-p/60675#M17214</link>
      <description>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 :&lt;BR /&gt;
ERROR: File is in use, \\svrbu3file\etc........&lt;BR /&gt;
&lt;BR /&gt;
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?&lt;BR /&gt;
&lt;BR /&gt;
Thanks.</description>
      <pubDate>Fri, 31 Jul 2009 06:01:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Detecting-an-existing-lock-on-external-output-file/m-p/60675#M17214</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-07-31T06:01:37Z</dc:date>
    </item>
    <item>
      <title>Re: Detecting an existing lock on external output file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Detecting-an-existing-lock-on-external-output-file/m-p/60676#M17215</link>
      <description>Further investigation shows a proc export will set the syscc to 1012 however when using ods syscc is still 0. &lt;BR /&gt;
&lt;BR /&gt;
Naturally it is ods that we are using &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
So if you know a way to check a file in use when creating a file using ods .... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Fri, 31 Jul 2009 07:05:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Detecting-an-existing-lock-on-external-output-file/m-p/60676#M17215</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-07-31T07:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: Detecting an existing lock on external output file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Detecting-an-existing-lock-on-external-output-file/m-p/60677#M17216</link>
      <description>Try to open the file through the external file functions, for example like this:&lt;BR /&gt;
&lt;BR /&gt;
%let FILENAME=D:\temp\Teste.xls;&lt;BR /&gt;
data _null_;&lt;BR /&gt;
RC=filename('MYFILE',"&amp;amp;FILENAME");&lt;BR /&gt;
FID=fopen('MYFILE','I');&lt;BR /&gt;
if not FID then put "File &amp;amp;FILENAME is in use!";&lt;BR /&gt;
else put "File &amp;amp;FILENAME opened successfully.";&lt;BR /&gt;
RC=fclose(FID);&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
FOPEN functions returns a file identifier (non zero integer) if the file was opened successfully.&lt;BR /&gt;
&lt;BR /&gt;
See more on this here:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a000209683.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a000209683.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Cheers from Portugal.&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;.</description>
      <pubDate>Fri, 31 Jul 2009 07:41:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Detecting-an-existing-lock-on-external-output-file/m-p/60677#M17216</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2009-07-31T07:41:27Z</dc:date>
    </item>
  </channel>
</rss>

