1
0
mirror of https://github.com/sasjs/core.git synced 2026-01-06 17:10:05 +00:00

fix: mp_abort cleanup

This commit is contained in:
Allan Bowe
2021-05-11 11:58:27 +03:00
parent aef14543f0
commit 223bdd5983
3 changed files with 62 additions and 20 deletions

27
all.sas
View File

@@ -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

View File

@@ -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 */

View File

@@ -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.
<h4> SAS Macros </h4>
@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()