[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sas-l
Subject:    Re: ERROR: File is in use
From:       Nikola Markovic <nik () BOEMSKATS ! COM>
Date:       2017-03-27 23:52:35
Message-ID: CABpch7W92ZvuPOwvkr-Jo9aoZMxkaZ7TiXFDnjkYD--NgzzKgA () mail ! gmail ! com
[Download RAW message or body]

Just stumbled on this post searching my inbox for the exact error message
in your subject :)

So in your case, like Phil says, it's probably that your VB script is still
holding onto the file when SAS tries to read it in. It might be your VM
being slower, or maybe its the virtual storage device being slower to flush
to disk. I still don't really get the point of these read-preventing file
locks in Windows.

But from my limited googling though it looks like you should be able to
test for the availability of a lock on the file by calling the FOPEN scl
function from inside your datastep. Something like

*data blah;*
*  /* your code */*
*  rc=fopen('my/favourite/file');*
*  if rc=0 then do;*

*    /* wait and then try again code */*
*  end;*
*  /* your other code */*
*run;*

might point you in the right direction. I don't know whether it needs to be
in its own data step, or how exactly it works, or if it works at all in
combination with normal ds set/infile/file statements etc. Hopefully
someone here with knowledge of SCL / the FDB can add to this though.

Nik
ᐧ

Nikola Markovic  [image: small logo]
t: (+44) 020 3642 4643 ext. 1000 <+442036424643,,1000>
m: (+44) 07875 952 755 22 Upper Ground
London, SE1 9PD

On Wed, Mar 15, 2017 at 11:40 PM, Phil Rack <PhilRack@minequest.com> wrote:

> Ya,
>
> Just a WAG here but perhaps your process cannot release the file fast
> enough?
>
> Might try to stall the processing for a moment with something like:
>
> Data _null_;
> X=Sleep(10,1);
> run;
>
> Phil
>
>
> Phil Rack, CEO
> MineQuest Business Analytics, LLC
> An Authorized WPS Reseller for North America
> PhilRack@MineQuest.com |  614.457.3714 | www.MineQuest.com
> Tucson, AZ: GMT -7 : Mountain Standard All Year - Currently EST -3 /CST -2
> / MST -1 / PST +0
>
> CONFIDENTIALITY: This e-mail (including any attachments) may contain
> confidential, proprietary and privileged information, any unauthorized
> disclosure or use is prohibited.  If you receive this e-mail in error,
> please notify the sender and delete this e-mail from your system.
>
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Ya
> Huang
> Sent: Wednesday, March 15, 2017 4:01 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: ERROR: File is in use
>
> Hi there,
>
> A piece of my code generate a text file by calling a VB script from within
> SAS, the text file is later read by SAS data step in the same program. This
> program works fine on my physical laptop. But when the code is run in a
> virtual PC, I got the error message as "ERROR: File is in use,
> C:\Users\xxx\AppData\Local\Temp\SAS Temporary Files\_TD3116_\xx.txt...
>
> Since I'm only reading the file, is there a way by pass the locking?
>
> Thanks
>
> Ya
>

[Attachment #3 (text/html)]

<div dir="ltr">Just stumbled on this post searching my inbox for the exact error \
message in your subject :)<div><br></div><div>So in your case, like Phil says, \
it&#39;s probably that your VB script is still holding onto the file when SAS tries \
to read it in. It might be your VM being slower, or maybe its the virtual storage \
device being slower to flush to disk. I still don&#39;t really get the point of these \
read-preventing file locks in Windows.</div><div><br></div><div>But from my limited \
googling though it looks like you should be able to test for the availability of a \
lock on the file by calling the FOPEN scl function from inside your datastep. \
Something like</div><div><br></div><div><font face="monospace, monospace"><b>data \
blah;</b></font></div><div><font face="monospace, monospace"><b>   /* your code \
*/</b></font></div><div><font face="monospace, monospace"><b>   \
rc=fopen(&#39;my/favourite/file&#39;);</b></font></div><div><font face="monospace, \
monospace"><b>   if rc=0 then do;</b></font></div><div><font face="monospace, \
monospace"><b>      /* wait and then try again code */<br></b></font></div><div><font \
face="monospace, monospace"><b>   end;</b></font></div><div><font face="monospace, \
monospace"><b>   /* your other code */</b></font></div><div><font face="monospace, \
monospace"><b>run;</b></font></div><div><br></div><div>might point you in the right \
direction. I don&#39;t know whether it needs to be in its own data step, or how \
exactly it works, or if it works at all in combination with normal ds set/infile/file \
statements etc. Hopefully someone here with knowledge of SCL / the FDB can add to \
this though.</div><div><br></div><div>Nik</div></div><div hspace="streak-pt-mark" \
style="max-height:1px"><img alt="" style="width:0px;max-height:0px;overflow:hidden" \
src="https://mailfoogae.appspot.com/t?sender=abmlrQGJvZW1za2F0cy5jb20%3D&amp;type=zerocontent&amp;guid=320075ae-d2df-412a-8ae4-aee018a4667f"><font \
color="#ffffff" size="1">ᐧ</font></div><div class="gmail_extra"><br \
clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div \
dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div \
dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><div \
style="font-size:small"><table border="0" cellpadding="0" cellspacing="0" \
style="color:rgb(0,0,0);font-family:Times;font-size:medium;width:380px"><tbody><tr><td \
style="padding:1em;background-color:rgb(250,250,250)"><span \
style="font-family:opensans,arial,sans-serif;font-size:small;color:rgb(102,102,102)">Nikola \
Markovic</span><span \
style="color:rgb(34,34,34);font-family:opensans,arial,sans-serif;font-size:12.8000001907349px"> \
</span></td><td style="text-align:center;padding:1em;background-color:rgb(238,238,238)"><img \
alt="small logo" src="http://boemskats.com/minisig.png" \
style="font-family:opensans,arial,sans-serif;font-size:small;color:rgb(79,79,79);width:76px;border-width:0px;border-style:solid;min-height:20px"></td></tr><tr><td \
style="padding:0em 1em \
1em;font-family:opensans,arial,sans-serif;font-size:small;background-color:rgb(250,250,250)"><span \
style="color:rgb(250,173,57)">t:</span><span style="color:rgb(102,102,102)">  <a \
href="tel:+442036424643,,1000" value="+442036424643,,10005" \
style="color:rgb(17,85,204)" target="_blank">(+44) 020 3642 4643 ext. \
1000</a></span><br><span style="color:rgb(250,173,57)">m:</span><span \
style="color:rgb(102,102,102)">  <a href="tel:%28%2B44%29%2007875%20952%20755" \
value="+447875952755" style="color:rgb(17,85,204)" target="_blank">(+44) 07875 952 \
755</a></span></td><td style="width:118px;text-align:center;padding:0em 1em \
1em;font-family:opensans,arial,sans-serif;font-size:small;background-color:rgb(238,238,238)"><span \
style="color:rgb(102,102,102)">22 Upper Ground<br>London, SE1 \
9PD<br></span></td></tr></tbody></table></div></div><div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
 <br><div class="gmail_quote">On Wed, Mar 15, 2017 at 11:40 PM, Phil Rack <span \
dir="ltr">&lt;<a href="mailto:PhilRack@minequest.com" \
target="_blank">PhilRack@minequest.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">Ya,<br> <br>
Just a WAG here but perhaps your process cannot release the file fast enough?<br>
<br>
Might try to stall the processing for a moment with something like:<br>
<br>
Data _null_;<br>
X=Sleep(10,1);<br>
run;<br>
<br>
Phil<br>
<br>
<br>
Phil Rack, CEO<br>
MineQuest Business Analytics, LLC<br>
An Authorized WPS Reseller for North America<br>
PhilRack@MineQuest.com |   614.457.3714 | <a href="http://www.MineQuest.com" \
rel="noreferrer" target="_blank">www.MineQuest.com</a><br> Tucson, AZ: GMT -7 : \
Mountain Standard All Year - Currently EST -3 /CST -2 / MST -1 / PST +0<br> <br>
CONFIDENTIALITY: This e-mail (including any attachments) may contain confidential, \
proprietary and privileged information, any unauthorized disclosure or use is \
prohibited.   If you receive this e-mail in error, please notify the sender and \
delete this e-mail from your system.<br> <div class="HOEnZb"><div class="h5"><br>
<br>
-----Original Message-----<br>
From: SAS(r) Discussion [mailto:<a \
href="mailto:SAS-L@LISTSERV.UGA.EDU">SAS-L@LISTSERV.UGA.EDU</a><wbr>] On Behalf Of Ya \
                Huang<br>
Sent: Wednesday, March 15, 2017 4:01 PM<br>
To: <a href="mailto:SAS-L@LISTSERV.UGA.EDU">SAS-L@LISTSERV.UGA.EDU</a><br>
Subject: ERROR: File is in use<br>
<br>
Hi there,<br>
<br>
A piece of my code generate a text file by calling a VB script from within SAS, the \
text file is later read by SAS data step in the same program. This program works fine \
on my physical laptop. But when the code is run in a virtual PC, I got the error \
message as &quot;ERROR: File is in use, C:\Users\xxx\AppData\Local\<wbr>Temp\SAS \
Temporary Files\_TD3116_\xx.txt...<br> <br>
Since I&#39;m only reading the file, is there a way by pass the locking?<br>
<br>
Thanks<br>
<br>
Ya<br>
</div></div></blockquote></div><br></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic