1
0
mirror of https://github.com/sasjs/core.git synced 2026-01-03 23:50:06 +00:00

Compare commits

..

4 Commits

Author SHA1 Message Date
Allan Bowe
67ba2a5286 fix: mp_abort on m6 win needs endsas 2022-06-03 17:45:27 +00:00
Allan Bowe
3d7f9b71e1 fix: hard abort in mm_getstpcode when the stp does not exist 2022-06-02 17:50:50 +00:00
Allan Bowe
1d972fad11 fix: using outref instead of outloc in mm_getstpcode invocation from mx_getcode 2022-05-31 22:42:40 +00:00
Allan Bowe
e23bc461c4 fix: mx_getcode platform support 2022-05-31 22:00:58 +00:00
5 changed files with 84 additions and 66 deletions

75
all.sas
View File

@@ -2200,16 +2200,20 @@ Usage:
recognise this and fetch the log of the parent session instead) recognise this and fetch the log of the parent session instead)
@li STP environments must finish cleanly to avoid the log being sent to @li STP environments must finish cleanly to avoid the log being sent to
_webout. To assist with this, we also run stpsrvset('program error', 0) _webout. To assist with this, we also run stpsrvset('program error', 0)
and set SYSCC=0. We take a unique "soft abort" approach - we open a macro and set SYSCC=0.
Where possible, we take a unique "soft abort" approach - we open a macro
but don't close it! This works everywhere EXCEPT inside a \%include inside but don't close it! This works everywhere EXCEPT inside a \%include inside
a macro. For that, we recommend you use mp_include.sas to perform the a macro. For that, we recommend you use mp_include.sas to perform the
include, and then call \%mp_abort(mode=INCLUDE) from the source program (ie, include, and then call \%mp_abort(mode=INCLUDE) from the source program (ie,
OUTSIDE of the top-parent macro). OUTSIDE of the top-parent macro).
The soft abort has also been found to be ineffective in 9.4m6 windows
environments.
@param mac= to contain the name of the calling macro @param mac= (mp_abort.sas) To contain the name of the calling macro. Do not
use &sysmacroname as this will always resolve to MP_ABORT.
@param msg= message to be returned @param msg= message to be returned
@param iftrue= supply a condition under which the macro should be executed. @param iftrue= (1=1) Supply a condition for which the macro should be executed
@param errds= (work.mp_abort_errds) There is no clean way to end a process @param errds= (work.mp_abort_errds) There is no clean way to end a process
within a %include called within a macro. Furthermore, there is no way to within a %include called within a macro. Furthermore, there is no way to
test if a macro is called within a %include. To handle this particular test if a macro is called within a %include. To handle this particular
@@ -2230,11 +2234,12 @@ Usage:
@li REGULAR (default) @li REGULAR (default)
@li INCLUDE @li INCLUDE
@version 9.4
@author Allan Bowe
<h4> Related Macros </h4> <h4> Related Macros </h4>
@li mp_include.sas @li mp_include.sas
@version 9.4
@author Allan Bowe
@cond @cond
**/ **/
@@ -2411,22 +2416,28 @@ Usage:
rc=stpsrvset('program error', 0); rc=stpsrvset('program error', 0);
call symputx("syscc",0,"g"); call symputx("syscc",0,"g");
run; run;
/** %if &sysscp=WIN and "%substr(&sysvlong. ,1,9)"="9.04.01M6" %then %do;
* endsas kills 9.4m3 deployments by orphaning multibridges. /* skip approach (below) does not work on this OS / version combo */
* Abort variants are ungraceful (non zero return code) endsas;
* This approach lets SAS run silently until the end :-) %end;
* Caution - fails when called within a %include within a macro %else %do;
* Use mp_include() to handle this. /**
*/ * endsas kills 9.4m3 deployments by orphaning multibridges.
filename skip temp; * Abort variants are ungraceful (non zero return code)
data _null_; * This approach lets SAS run silently until the end :-)
file skip; * Caution - fails when called within a %include within a macro
put '%macro skip();'; * Use mp_include() to handle this.
comment '%mend skip; -> fix lint '; */
put '%macro skippy();'; filename skip temp;
comment '%mend skippy; -> fix lint '; data _null_;
run; file skip;
%inc skip; put '%macro skip();';
comment '%mend skip; -> fix lint ';
put '%macro skippy();';
comment '%mend skippy; -> fix lint ';
run;
%inc skip;
%end;
%end; %end;
%else %if "&sysprocessmode " = "SAS Compute Server " %then %do; %else %if "&sysprocessmode " = "SAS Compute Server " %then %do;
/* endsas kills the session making it harder to fetch results */ /* endsas kills the session making it harder to fetch results */
@@ -16214,17 +16225,15 @@ filename __outdoc clear;
Usage: Usage:
options ps=max nonotes nosource; options ps=max nonotes nosource;
%mm_getfoldertree(root=/My/Meta/Path, outds=iwantthisdataset) %mm_getfoldertree(root=/My/Meta/Path, outds=iwantthisdataset)
options notes source; options notes source;
@param [in] root= the parent folder under which to return all contents @param [in] root= the parent folder under which to return all contents
@param [out] outds= the dataset to create that contains the list of @param [out] outds= the dataset to create that contains the list of
directories directories
@param [in] mDebug= set to 1 to show debug messages in the log @param [in] mDebug= set to 1 to show debug messages in the log
<h4> SAS Macros </h4>
@version 9.4 @version 9.4
@author Allan Bowe @author Allan Bowe
@@ -17163,6 +17172,7 @@ filename __mc2 clear;
<h4> SAS Macros </h4> <h4> SAS Macros </h4>
@li mf_getuniquefileref.sas @li mf_getuniquefileref.sas
@li mp_abort.sas
@author Allan Bowe @author Allan Bowe
@@ -17212,11 +17222,10 @@ data _null_;
else put (_all_)(=); else put (_all_)(=);
run; run;
%if &tsuri=stopifempty %then %do; %mp_abort(iftrue= (&tsuri=stopifempty)
%put %str(WARN)ING: &tree&name.(StoredProcess) not found!; ,mac=mm_getstpcode
%return; ,msg=%str(&tree&name.(StoredProcess) not found!)
%end; )
/** /**
* Now we can extract the textstore * Now we can extract the textstore
@@ -26979,8 +26988,8 @@ Usage:
%if &platform=SASJS %then %do; %if &platform=SASJS %then %do;
%ms_getfile(&loc..sas, outref=&outref) %ms_getfile(&loc..sas, outref=&outref)
%end; %end;
%else %if &platform=SAS9 %then %do; %else %if &platform=SAS9 or &platform=SASMETA %then %do;
%mm_getstpcode(tree=&loc,outloc=&outref) %mm_getstpcode(tree=&loc,outref=&outref)
%end; %end;
%else %if &platform=SASVIYA %then %do; %else %if &platform=SASVIYA %then %do;
/* extract name & path from &loc */ /* extract name & path from &loc */

View File

@@ -15,16 +15,20 @@
recognise this and fetch the log of the parent session instead) recognise this and fetch the log of the parent session instead)
@li STP environments must finish cleanly to avoid the log being sent to @li STP environments must finish cleanly to avoid the log being sent to
_webout. To assist with this, we also run stpsrvset('program error', 0) _webout. To assist with this, we also run stpsrvset('program error', 0)
and set SYSCC=0. We take a unique "soft abort" approach - we open a macro and set SYSCC=0.
Where possible, we take a unique "soft abort" approach - we open a macro
but don't close it! This works everywhere EXCEPT inside a \%include inside but don't close it! This works everywhere EXCEPT inside a \%include inside
a macro. For that, we recommend you use mp_include.sas to perform the a macro. For that, we recommend you use mp_include.sas to perform the
include, and then call \%mp_abort(mode=INCLUDE) from the source program (ie, include, and then call \%mp_abort(mode=INCLUDE) from the source program (ie,
OUTSIDE of the top-parent macro). OUTSIDE of the top-parent macro).
The soft abort has also been found to be ineffective in 9.4m6 windows
environments.
@param mac= to contain the name of the calling macro @param mac= (mp_abort.sas) To contain the name of the calling macro. Do not
use &sysmacroname as this will always resolve to MP_ABORT.
@param msg= message to be returned @param msg= message to be returned
@param iftrue= supply a condition under which the macro should be executed. @param iftrue= (1=1) Supply a condition for which the macro should be executed
@param errds= (work.mp_abort_errds) There is no clean way to end a process @param errds= (work.mp_abort_errds) There is no clean way to end a process
within a %include called within a macro. Furthermore, there is no way to within a %include called within a macro. Furthermore, there is no way to
test if a macro is called within a %include. To handle this particular test if a macro is called within a %include. To handle this particular
@@ -45,11 +49,12 @@
@li REGULAR (default) @li REGULAR (default)
@li INCLUDE @li INCLUDE
@version 9.4
@author Allan Bowe
<h4> Related Macros </h4> <h4> Related Macros </h4>
@li mp_include.sas @li mp_include.sas
@version 9.4
@author Allan Bowe
@cond @cond
**/ **/
@@ -226,22 +231,28 @@
rc=stpsrvset('program error', 0); rc=stpsrvset('program error', 0);
call symputx("syscc",0,"g"); call symputx("syscc",0,"g");
run; run;
/** %if &sysscp=WIN and "%substr(&sysvlong. ,1,9)"="9.04.01M6" %then %do;
* endsas kills 9.4m3 deployments by orphaning multibridges. /* skip approach (below) does not work on this OS / version combo */
* Abort variants are ungraceful (non zero return code) endsas;
* This approach lets SAS run silently until the end :-) %end;
* Caution - fails when called within a %include within a macro %else %do;
* Use mp_include() to handle this. /**
*/ * endsas kills 9.4m3 deployments by orphaning multibridges.
filename skip temp; * Abort variants are ungraceful (non zero return code)
data _null_; * This approach lets SAS run silently until the end :-)
file skip; * Caution - fails when called within a %include within a macro
put '%macro skip();'; * Use mp_include() to handle this.
comment '%mend skip; -> fix lint '; */
put '%macro skippy();'; filename skip temp;
comment '%mend skippy; -> fix lint '; data _null_;
run; file skip;
%inc skip; put '%macro skip();';
comment '%mend skip; -> fix lint ';
put '%macro skippy();';
comment '%mend skippy; -> fix lint ';
run;
%inc skip;
%end;
%end; %end;
%else %if "&sysprocessmode " = "SAS Compute Server " %then %do; %else %if "&sysprocessmode " = "SAS Compute Server " %then %do;
/* endsas kills the session making it harder to fetch results */ /* endsas kills the session making it harder to fetch results */

View File

@@ -8,17 +8,15 @@
Usage: Usage:
options ps=max nonotes nosource; options ps=max nonotes nosource;
%mm_getfoldertree(root=/My/Meta/Path, outds=iwantthisdataset) %mm_getfoldertree(root=/My/Meta/Path, outds=iwantthisdataset)
options notes source; options notes source;
@param [in] root= the parent folder under which to return all contents @param [in] root= the parent folder under which to return all contents
@param [out] outds= the dataset to create that contains the list of @param [out] outds= the dataset to create that contains the list of
directories directories
@param [in] mDebug= set to 1 to show debug messages in the log @param [in] mDebug= set to 1 to show debug messages in the log
<h4> SAS Macros </h4>
@version 9.4 @version 9.4
@author Allan Bowe @author Allan Bowe

View File

@@ -21,6 +21,7 @@
<h4> SAS Macros </h4> <h4> SAS Macros </h4>
@li mf_getuniquefileref.sas @li mf_getuniquefileref.sas
@li mp_abort.sas
@author Allan Bowe @author Allan Bowe
@@ -70,11 +71,10 @@ data _null_;
else put (_all_)(=); else put (_all_)(=);
run; run;
%if &tsuri=stopifempty %then %do; %mp_abort(iftrue= (&tsuri=stopifempty)
%put %str(WARN)ING: &tree&name.(StoredProcess) not found!; ,mac=mm_getstpcode
%return; ,msg=%str(&tree&name.(StoredProcess) not found!)
%end; )
/** /**
* Now we can extract the textstore * Now we can extract the textstore

View File

@@ -34,8 +34,8 @@
%if &platform=SASJS %then %do; %if &platform=SASJS %then %do;
%ms_getfile(&loc..sas, outref=&outref) %ms_getfile(&loc..sas, outref=&outref)
%end; %end;
%else %if &platform=SAS9 %then %do; %else %if &platform=SAS9 or &platform=SASMETA %then %do;
%mm_getstpcode(tree=&loc,outloc=&outref) %mm_getstpcode(tree=&loc,outref=&outref)
%end; %end;
%else %if &platform=SASVIYA %then %do; %else %if &platform=SASVIYA %then %do;
/* extract name & path from &loc */ /* extract name & path from &loc */