diff --git a/all.sas b/all.sas index a30009a..c1dfc10 100644 --- a/all.sas +++ b/all.sas @@ -1748,19 +1748,26 @@ Usage: if debug ge '"131"' then put '>>weboutEND<<'; run; - %if %symexist(_metaport) %then %do; - data _null_; - if symexist('sysprocessmode') then - if symget("sysprocessmode")="SAS Stored Process Server" then do; - rc=stpsrvset('program error', 0); - call symputx("syscc",0,"g"); - end; - run; + data _null_; + if symexist('sysprocessmode') then + if symget("sysprocessmode")="SAS Stored Process Server" then do; + putlog 'stpsrvset program error and syscc'; + rc=stpsrvset('program error', 0); + call symputx("syscc",0,"g"); + end; + run; + %if "%substr(&sysvlong.xxxxxxx,1,9)" ne "9.04.01M3" %then %do; + %put NOTE: Ending SAS session due to:; + %put NOTE- &msg; + endsas; %end; + SYSVLONG=9.04.01M7P080520 /** - * endsas is reliable but kills some deployments. + * endsas is reliable but kills 9.4m3 deployments by hanging multibridges. * Abort variants are ungraceful (non zero return code) * This approach lets SAS run silently until the end :-) + * Caution - fails when called within a %include within a macro + * See tests/mp_abort.test.1 for an example case. */ %put _all_; filename skip temp; @@ -1774,7 +1781,7 @@ Usage: %put _all_; %abort cancel; %end; -%mend; +%mend mp_abort; /** @endcond *//** @file diff --git a/base/mp_abort.sas b/base/mp_abort.sas index c9e9043..e73f31a 100644 --- a/base/mp_abort.sas +++ b/base/mp_abort.sas @@ -128,19 +128,26 @@ if debug ge '"131"' then put '>>weboutEND<<'; run; - %if %symexist(_metaport) %then %do; - data _null_; - if symexist('sysprocessmode') then - if symget("sysprocessmode")="SAS Stored Process Server" then do; - rc=stpsrvset('program error', 0); - call symputx("syscc",0,"g"); - end; - run; + data _null_; + if symexist('sysprocessmode') then + if symget("sysprocessmode")="SAS Stored Process Server" then do; + putlog 'stpsrvset program error and syscc'; + rc=stpsrvset('program error', 0); + call symputx("syscc",0,"g"); + end; + run; + %if "%substr(&sysvlong.xxxxxxx,1,9)" ne "9.04.01M3" %then %do; + %put NOTE: Ending SAS session due to:; + %put NOTE- &msg; + endsas; %end; + SYSVLONG=9.04.01M7P080520 /** - * endsas is reliable but kills some deployments. + * endsas is reliable but kills 9.4m3 deployments by hanging multibridges. * Abort variants are ungraceful (non zero return code) * This approach lets SAS run silently until the end :-) + * Caution - fails when called within a %include within a macro + * See tests/mp_abort.test.1 for an example case. */ %put _all_; filename skip temp; @@ -154,6 +161,6 @@ %put _all_; %abort cancel; %end; -%mend; +%mend mp_abort; /** @endcond */ \ No newline at end of file diff --git a/tests/base/mp_abort.test.1.sas b/tests/base/mp_abort.test.1.sas new file mode 100644 index 0000000..cbff2ce --- /dev/null +++ b/tests/base/mp_abort.test.1.sas @@ -0,0 +1,28 @@ +/** + @file + @brief Testing mp_abort macro + @details This is an unfixed problem with mp_abort. When called from within + a macro, within a %include, and that macro contains subsequent logic, the + service does not end cleanly - rather, we see: + + ERROR: %EVAL function has no expression to evaluate, or %IF statement has no condition. + ERROR: The macro TEST will stop executing. + +

SAS Macros

+ @li mp_abort.sas + +**/ + +%macro test(); + +filename blah temp; +data _null_; + file blah; + put '%mp_abort();'; +run; +%inc blah; + +%if 1=1 %then %put Houston - we have a problem here; +%mend test; + +%test() \ No newline at end of file