BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
BenConner
Pyrite | Level 9

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

1 ACCEPTED SOLUTION

Accepted Solutions
Ron_MacroMaven
Lapis Lazuli | Level 10

 

%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

 

View solution in original post

4 REPLIES 4
Ron_MacroMaven
Lapis Lazuli | Level 10

 

%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

 

Ron_MacroMaven
Lapis Lazuli | Level 10

... so you are probably looking for the open function?

 

BenConner
Pyrite | Level 9

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

BenConner
Pyrite | Level 9

Wow.  That's impressive.  Thanks for posting this, Ron!

 

--Ben

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1431 views
  • 0 likes
  • 2 in conversation