diff --git a/all.sas b/all.sas
index 479dcc2..0baa843 100644
--- a/all.sas
+++ b/all.sas
@@ -2914,7 +2914,7 @@ run;
results. If it does not exist, it will be created, with the following format:
|TEST_DESCRIPTION:$256|TEST_RESULT:$4|TEST_COMMENTS:$256|
|---|---|---|
- |User Provided description|PASS|Column &inds contained ALL columns|
+ |User Provided description|PASS|Dataset &inds contained ALL columns|
@version 9.2
@author Allan Bowe
@@ -2988,7 +2988,7 @@ run;
results. If it does not exist, it will be created, with the following format:
|TEST_DESCRIPTION:$256|TEST_RESULT:$4|TEST_COMMENTS:$256|
|---|---|---|
- |User Provided description|PASS|Column &inds contained ALL columns|
+ |User Provided description|PASS|Dataset &inds contained ALL columns|
Related Macros
@@ -10484,7 +10484,10 @@ run;
where LOCK_LIB ="&lib" and LOCK_DS="&ds";
quit;
%if &syscc>0 %then %put syscc=&syscc sqlrc=&sqlrc;
- %if &status=LOCKED %then %do;
+ %if &sqlobs=0 %then %do;
+ %put %str(WAR)NING: &lib..&ds has never been locked!;
+ %end;
+ %else %if &status=LOCKED %then %do;
data _null_;
putlog "&sysmacroname: unlocking &lib..&ds:";
run;
diff --git a/base/mp_lockanytable.sas b/base/mp_lockanytable.sas
index aa8c3ff..cfe5c02 100644
--- a/base/mp_lockanytable.sas
+++ b/base/mp_lockanytable.sas
@@ -200,7 +200,10 @@ run;
where LOCK_LIB ="&lib" and LOCK_DS="&ds";
quit;
%if &syscc>0 %then %put syscc=&syscc sqlrc=&sqlrc;
- %if &status=LOCKED %then %do;
+ %if &sqlobs=0 %then %do;
+ %put %str(WAR)NING: &lib..&ds has never been locked!;
+ %end;
+ %else %if &status=LOCKED %then %do;
data _null_;
putlog "&sysmacroname: unlocking &lib..&ds:";
run;
diff --git a/tests/base/mp_lockanytable.test.sas b/tests/base/mp_lockanytable.test.sas
index 40b595f..b5e31ad 100644
--- a/tests/base/mp_lockanytable.test.sas
+++ b/tests/base/mp_lockanytable.test.sas
@@ -4,8 +4,10 @@
SAS Macros
@li mp_lockanytable.sas
+ @li mp_assert.sas
@li mp_assertcols.sas
@li mp_assertcolvals.sas
+ @li mp_assertscope.sas
@li mp_coretable.sas
**/
@@ -61,3 +63,18 @@ run;
desc=Ref is captured in unlock,
test=ANYVAL
)
+
+/* attempt unlock of a table that was never locked */
+
+%mp_lockanytable(UNLOCK,lib=no,ds=doesnotexist,ref=bye, ctl_ds=work.controller)
+
+%mp_assert(
+ iftrue=(&syscc=0),
+ desc=Ability to unlock a table that was never locked,
+ outds=work.test_results
+)
+
+/* test for macro variable scope leakage */
+%mp_assertscope(SNAPSHOT)
+%mp_lockanytable(LOCK,lib=tmp,ds=testscope,ref=This Ref, ctl_ds=work.controller)
+%mp_assertscope(COMPARE)