<?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 Re: Issue with archive file locking in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-archive-file-locking/m-p/759623#M240095</link>
    <description>&lt;P&gt;Hi!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please show us the complete log of the failing step.&lt;/P&gt;
&lt;P&gt;Open dataset files usually result in a message that says that write lock is not possible, and contain the number of the/a process getting in your way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On UNIX, it is possible to remove a directory entry (link) for a file that is in use. My paper from #SASGF 2021 shows a macro to do this. A similar macro is in use in all our production batch jobs.&lt;/P&gt;</description>
    <pubDate>Thu, 05 Aug 2021 05:57:29 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-08-05T05:57:29Z</dc:date>
    <item>
      <title>Issue with archive file locking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-archive-file-locking/m-p/759336#M239955</link>
      <description>&lt;P&gt;I have a report that is running on our SAS server as a kind of an alarm. Every 30 minutes it pulls data in from a database and then compares to an archive file (sas7bdat), emailing if there are new entries that were not in the archive file, then it writes over the archive file with the new entries for the next time the program runs. For some reason at random intervals archive file will lock (sas7.dbat.lck) and then I have to come in and reconstruct the file before it will run again. The code only takes about 45 secs to run on the server, so I don't think it is running over itself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why is this happening? Why at random intervals? How can I prevent it?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 14:19:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-archive-file-locking/m-p/759336#M239955</guid>
      <dc:creator>imead</dc:creator>
      <dc:date>2021-08-04T14:19:14Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with archive file locking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-archive-file-locking/m-p/759344#M239961</link>
      <description>&lt;P&gt;What does the LOG show related to that data set when it is locked?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do any other processes use the set?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 14:27:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-archive-file-locking/m-p/759344#M239961</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-08-04T14:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with archive file locking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-archive-file-locking/m-p/759354#M239969</link>
      <description>&lt;P&gt;Once the file changes from a file format of sas7bdat to sas7bdat.lck, the log shows the following error:&lt;/P&gt;&lt;P&gt;ERROR: File LIBNAME.FILENAME.DATA does not exist.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nothing else is pointed towards this folder and I just made the report, so nothing else I know would be using the file but this report. It is stored on our shared UNIX network drive, I have read on these forums that sometimes IT virus software can cause issues if they are scanning a file while the server is trying to run it. Is there a workaround for trying to prevent this?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 14:40:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-archive-file-locking/m-p/759354#M239969</guid>
      <dc:creator>imead</dc:creator>
      <dc:date>2021-08-04T14:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with archive file locking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-archive-file-locking/m-p/759515#M240027</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/329957"&gt;@imead&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Once the file changes from a file format of sas7bdat to sas7bdat.lck, the log shows the following error:&lt;/P&gt;
&lt;P&gt;ERROR: File LIBNAME.FILENAME.DATA does not exist.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That seems like unusual behavior to me.&amp;nbsp; At least in my installation, the .sas7bdat is not removed until SAS is completely done writing to&amp;nbsp; the.sas7bdat.lck.&amp;nbsp; When completely done, then the .sas7bdat is deleted and the sas7bdat.lck is (presumably) renamed to a .sas7bdat file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One possibility for remediation might be to use the generations feature of SAS.&amp;nbsp; Depending on how big the file is, you could save multiple generations of the file.&amp;nbsp; When writing to a new sas7bdat.lck, the existing file is not deleted but is renamed to #nnnn where nnnn is a sequential number that iterates by +1 every time a new version is created.&amp;nbsp; I don't think this will solve a (potential) virus scanning software issue, but it's worth a shot.&amp;nbsp; It might get rid of the "does not exist" errors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 21:10:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-archive-file-locking/m-p/759515#M240027</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-08-04T21:10:29Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with archive file locking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-archive-file-locking/m-p/759557#M240048</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;has a utility program that deals with this issue and it may be useful to you so l'm linking him in.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 23:18:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-archive-file-locking/m-p/759557#M240048</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-08-04T23:18:25Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with archive file locking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-archive-file-locking/m-p/759562#M240051</link>
      <description>&lt;P&gt;No doubt&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;will have more to say about this, but since it currently is about 0130 in the morning in Germany (I think he lives in Germany), I will post the link to his post here:&amp;nbsp;&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Avoiding-the-dreaded-quot-Dataset-is-locked-quot-ERROR/ta-p/653210" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Avoiding-the-dreaded-quot-Dataset-is-locked-quot-ERROR/ta-p/653210&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 23:38:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-archive-file-locking/m-p/759562#M240051</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-08-04T23:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with archive file locking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-archive-file-locking/m-p/759568#M240057</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/37107"&gt;@jimbarbour&lt;/a&gt;&amp;nbsp; - Austria actually but probably same time zone&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Aug 2021 00:07:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-archive-file-locking/m-p/759568#M240057</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-08-05T00:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with archive file locking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-archive-file-locking/m-p/759585#M240074</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt; it writes over the archive file with the new entries&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;It would be faster (unsure about safer, anyone cares to comment?) to append.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Aug 2021 02:34:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-archive-file-locking/m-p/759585#M240074</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-08-05T02:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with archive file locking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-archive-file-locking/m-p/759588#M240077</link>
      <description>&lt;P&gt;I think it would help if you posted the code that is intermittently causing this problem.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Aug 2021 02:40:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-archive-file-locking/m-p/759588#M240077</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-08-05T02:40:23Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with archive file locking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-archive-file-locking/m-p/759598#M240080</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;, &lt;BR /&gt;&lt;BR /&gt;Proc Append has been super reliable in my experience. It's Update that is really dangerous and can corrupt a dataset.&lt;BR /&gt;&lt;BR /&gt;Jim</description>
      <pubDate>Thu, 05 Aug 2021 02:56:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-archive-file-locking/m-p/759598#M240080</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-08-05T02:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with archive file locking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-archive-file-locking/m-p/759621#M240094</link>
      <description>&lt;P&gt;But APPEND needs write access for the dataset, and if any process has the file open for any reason, you can't get that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's why all my production "update" jobs do the concatenation in work, remove the target file with my macro, and then write it.&lt;/P&gt;
&lt;P&gt;Care must be taken if more than one job needs to update the same dataset, then you shoul probably look into using a semaphore. I use that for writing to our main jobcontrol dataset that keeps track of all batch jobs.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Aug 2021 05:51:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-archive-file-locking/m-p/759621#M240094</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-08-05T05:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with archive file locking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-archive-file-locking/m-p/759623#M240095</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please show us the complete log of the failing step.&lt;/P&gt;
&lt;P&gt;Open dataset files usually result in a message that says that write lock is not possible, and contain the number of the/a process getting in your way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On UNIX, it is possible to remove a directory entry (link) for a file that is in use. My paper from #SASGF 2021 shows a macro to do this. A similar macro is in use in all our production batch jobs.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Aug 2021 05:57:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-archive-file-locking/m-p/759623#M240095</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-08-05T05:57:29Z</dc:date>
    </item>
  </channel>
</rss>

