<?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: Acquire a lock on SAS data set in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Acquire-a-lock-on-SAS-data-set/m-p/126023#M25698</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the problem is that you cannot stop the current user/use of a table to apply the lock.&lt;/P&gt;&lt;P&gt;What would be nice is a RESERVE type of lock.&lt;/P&gt;&lt;P&gt;Macro %TRYLOCK() is an attempt to obtain a lock. However this is os-dependent - if it doesn't support that functionality. I think there is nothing else to hold that RESERVE-request. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 28 Oct 2013 22:52:09 GMT</pubDate>
    <dc:creator>Peter_C</dc:creator>
    <dc:date>2013-10-28T22:52:09Z</dc:date>
    <item>
      <title>Acquire a lock on SAS data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Acquire-a-lock-on-SAS-data-set/m-p/126019#M25694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need change a SAS data set's name while someone is reading the data from the data set.&lt;/P&gt;&lt;P&gt;It does not matter the renaming interrupts the reading.&lt;/P&gt;&lt;P&gt;How can I acquire the a lock and force to rename the data set?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;Shi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Oct 2013 13:48:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Acquire-a-lock-on-SAS-data-set/m-p/126019#M25694</guid>
      <dc:creator>ASASProgrammer</dc:creator>
      <dc:date>2013-10-28T13:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: Acquire a lock on SAS data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Acquire-a-lock-on-SAS-data-set/m-p/126020#M25695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't believe this is possible - not without SAS/Share anyway. SAS uses operating system locking. If a SAS dataset is locked while being read, it means the file is locked by the operating system so you can't "force" a lock and rename it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What operating system are you using? I believe Unix may be more flexible in this area than Windows. If you were using SAS/Share and the dataset was being accessed via a SAS/Share server then I think this might be possible.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Oct 2013 20:00:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Acquire-a-lock-on-SAS-data-set/m-p/126020#M25695</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2013-10-28T20:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: Acquire a lock on SAS data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Acquire-a-lock-on-SAS-data-set/m-p/126021#M25696</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the information.&lt;/P&gt;&lt;P&gt;It is on Unix box.&lt;/P&gt;&lt;P&gt;It might not be a OS level lock.&lt;/P&gt;&lt;P&gt;I tested with a small text file:&amp;nbsp; Open a file with vi in one session, and I still can rename it with mv in another session.&lt;/P&gt;&lt;P&gt;However, even for small SAS data set, when one session reading the data set, it is not allowed to change the name with proc datasets.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It can be renamed with mv using xcmd, but it is not a "pure" SAS way...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Oct 2013 20:39:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Acquire-a-lock-on-SAS-data-set/m-p/126021#M25696</guid>
      <dc:creator>ASASProgrammer</dc:creator>
      <dc:date>2013-10-28T20:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: Acquire a lock on SAS data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Acquire-a-lock-on-SAS-data-set/m-p/126022#M25697</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To obtain a lock you can use the lock statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data foo;&lt;/P&gt;&lt;P&gt;set sashelp.class;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lock work.foo;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc datasets lib=work;&lt;/P&gt;&lt;P&gt;change foo=bar;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lock work.foo clear;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I remember an old paper that contained a macro call %trylock, which you may find useful.&amp;nbsp; You cannot lock a SAS file or modify one by force when a lock is held by another process in SAS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could try having the session performing the read use cntllev=rec, but I have not tested it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found the paper, I think: &lt;A href="http://www.lexjansen.com/pharmasug/2005/posters/po33.pdf" title="http://www.lexjansen.com/pharmasug/2005/posters/po33.pdf"&gt;http://www.lexjansen.com/pharmasug/2005/posters/po33.pdf&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Oct 2013 22:21:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Acquire-a-lock-on-SAS-data-set/m-p/126022#M25697</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2013-10-28T22:21:14Z</dc:date>
    </item>
    <item>
      <title>Re: Acquire a lock on SAS data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Acquire-a-lock-on-SAS-data-set/m-p/126023#M25698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the problem is that you cannot stop the current user/use of a table to apply the lock.&lt;/P&gt;&lt;P&gt;What would be nice is a RESERVE type of lock.&lt;/P&gt;&lt;P&gt;Macro %TRYLOCK() is an attempt to obtain a lock. However this is os-dependent - if it doesn't support that functionality. I think there is nothing else to hold that RESERVE-request. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Oct 2013 22:52:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Acquire-a-lock-on-SAS-data-set/m-p/126023#M25698</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2013-10-28T22:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: Acquire a lock on SAS data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Acquire-a-lock-on-SAS-data-set/m-p/126024#M25699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've tried in the past to make this %trylock() macro work failsafe but with no real success. So can't really recommend to use it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Oct 2013 23:22:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Acquire-a-lock-on-SAS-data-set/m-p/126024#M25699</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2013-10-28T23:22:14Z</dc:date>
    </item>
  </channel>
</rss>

