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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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