Date: Thu, 22 Aug 2002 16:53:31 -0700
Reply-To: WCheng@ISISPH.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Wei Cheng <WCheng@ISISPH.COM>
Subject: Re: macro code: How to check whether file is locked
Content-Type: multipart/alternative;
Does anyone know a Windows equivalent to find the user?
Thanks,
Wei
Peter Crawford <peter.crawford@DB.COM>
Sent by: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
08/22/02 01:27 PM
Please respond to Peter Crawford
To: SAS-L@LISTSERV.UGA.EDU
cc:
Subject: Re: macro code: How to check whether file is locked
on unix, you might discover with ( aix /Korn shell) system
command fuser -u filename
Here is an example generating the full path and low case
table name
filename inuse pipe
"fuser -u %sysfunc(pathname(<libref>))/%lowcase(<memname>.sas7bdat" ;
To check output from the command, try it first with a datastep like
data;
infile inuse ;
input ;
put _infile_ ;
run;
Output is like
/path/filename: processID(userID)
So you could try
data;
infile inuse ;
put _infile_ ;
input ;
If scan( _infile_,2,':') ne ' ' then
do; length locker P_id $16.
locker = scan( _infile_, 2, '()' );
P_id = scan( _infile_, 2, ':(' );
Put "send rude messages to "he who holds the data' ="
locker= p_id= ;
output ;
end;
run;
And then you know who to speak to !
Good Luck
Peter Crawford
Datum: 22/08/2002 17:34
An: SAS-L@LISTSERV.UGA.EDU
Antwort an: alte@uni-greifswald.de
Betreff: macro code: How to check whether file is locked
Nachrichtentext:
Dear all,
having tried with open and sysmsg - but not successful.
How can I check before writing to a sas file (sas7bdat) in macro code,
whether this file is locked by some other user?
TIA
--
-----------------------------------------------------------------
Dietrich Alte (Statistician, Dipl.-Stat.)
University of Greifswald - Medical Faculty
Institute of Epidemiology and Social Medicine
Walther-Rathenau-Str. 48, D-17487 Greifswald, Germany
Phone +49 (0) 3834 - 86 77 13, fax +49 (0) 3834 - 86 66 84
Email alte@uni-greifswald.de
Institute http://www.medizin.uni-greifswald.de/epidem/
Study http://www.medizin.uni-greifswald.de/epidem/ship.htm
-----------------------------------------------------------------
--
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail
irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und
vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte
Weitergabe dieser Mail ist nicht gestattet.
This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.
[text/html]