Hi,
We're updating a bunch of master files and at times a user will have one open. The process fails as it replaces the files and can't get member level locking.
I looked through the functions available but none stood out to detect this condition ahead of time. Anyone have any suggestions?
Windows 2012 server environment in TS1M5.
Thanks!
--Ben
%MACRO RTRACERDx(PRODFILE,RTRACEFL,testing = 1);
********************************************************************;
* Allocate the RTRACE flat file. *;
********************************************************************;
filename rtracefl "&RTRACEFL";
********************************************************************;
* Determine if the RTRACE flat file is in use. *;
********************************************************************;
data _null_;
inuse = fopen('rtracefl');
call symput('INUSE',inuse);
if inuse = 0 then do;
put '*** Attention: the file below was in use ***';
put "&RTRACEFL";
put _all_;
put '*** Attention: the file above was in use ***';
end;
run;
*...;
%mend;
Hi Ben
The above is from Michael Raithel's paper on the LogParse Macro.
Measure_SAS_Application_Performance_with_LogParse_Macro
I wrote a follow-up
Modifying_The_LogParse_PassInfo_Macro
hth
Ron Fehd macro maven
%MACRO RTRACERDx(PRODFILE,RTRACEFL,testing = 1);
********************************************************************;
* Allocate the RTRACE flat file. *;
********************************************************************;
filename rtracefl "&RTRACEFL";
********************************************************************;
* Determine if the RTRACE flat file is in use. *;
********************************************************************;
data _null_;
inuse = fopen('rtracefl');
call symput('INUSE',inuse);
if inuse = 0 then do;
put '*** Attention: the file below was in use ***';
put "&RTRACEFL";
put _all_;
put '*** Attention: the file above was in use ***';
end;
run;
*...;
%mend;
Hi Ben
The above is from Michael Raithel's paper on the LogParse Macro.
Measure_SAS_Application_Performance_with_LogParse_Macro
I wrote a follow-up
Modifying_The_LogParse_PassInfo_Macro
hth
Ron Fehd macro maven
... so you are probably looking for the open function?
I'd tried opening a SAS dataset but it opened fine while I was reading that file in another session. I gather this will work with the full filename, etc. handed to it.
I can then wait for blocks of time until it is released.
Thanks again!
--Ben
Wow. That's impressive. Thanks for posting this, Ron!
--Ben
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: