BookmarkSubscribeRSS Feed
LinusH
Tourmaline | Level 20
Hi everyone,
Does anybody know a convenient way to find out if I can get an exclusive lock on table, before a batch job is launched? We are using 9.1.3, and both Base and SPDE. Since SPDE apparently doesn't support the LOCK statement, and the OPEN function just open tables in input mode, I don't know what to do.

Thanks,

Linus
Data never sleeps
4 REPLIES 4
Flip
Fluorite | Level 6
Here is an example out of a system I am writing. It keeps trying every few seconds until it is free.

%macro update_year( fiscyear);
%if (&syserr = %sysrc(_sok)) %then %do;
%put &sysrc ;
%TRYAGAIN:
lock currbw.br_years;
%put &syslckrc;
%if (&SYSLCKRC ne %sysrc(_sok)) %then %do;
%let rc = %sysfunc(sleep(20000));

%goto TRYAGAIN;
%end;
%else %do;
CALL YOUR EXECUTION HERE;
%end;
lock currbw.br_years clear;
%end;
%else %put Status file not updated for FY &fiscyear because errcode was &syserr ;
%mend;
LinusH
Tourmaline | Level 20
Thanks for your quick response. But SPDE does not support the LOCK statement unfortunately, so I need something else for those libraries.

/Linus
Data never sleeps
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
You may want to experiment with using LIBNAME / FILENAME and interrogating automatic variables SYSFILRC or SYSLIBRC. Also the parameter WAIT=nn and the SAS OPTIONS FILEMSGS may influence SAS behavior when unsuccessful.

Scott Barry
SBBWorks, Inc.
LinusH
Tourmaline | Level 20
Since our concern is locking on individual objects, I don't think SYSLIBRC will be useful, neither SYSFILRC (which tells whether a physical location/file exists or not). I might be helped with FILEMSGS in some way, but unfortunately we are in UNIX (Solaris), not z/os. I'm not sure how I am intend to use WAIT in this situation.

Regards,
Linus
Data never sleeps

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 784 views
  • 0 likes
  • 3 in conversation