18 %macro mf_abort(mac=mf_abort.sas, type=, msg=, iftrue=%str(1=1)
    21   %
if not(%eval(%unquote(&iftrue))) %then %
return;
    24   %
if %length(&mac)>0 %then %put NOTE- called by &mac;
    26   %
if not %symexist(h54sDebuggingMode) %then %
do;
    27     %let h54sDebuggingMode=0;
    30   %
if %symexist(_metaperson) %then %
do;
    31     options obs=max replace nosyntaxcheck mprint;
    33     %local logloc logline;
    35     %
if %symexist(SYSPRINTTOLOG) %then %let logloc=&SYSPRINTTOLOG;
    36     %
else %let logloc=%qsysfunc(getoption(LOG));
    37     proc printto log=log;run;
    38     %
if %length(&logloc)>0 %then %
do;
    41         infile &logloc lrecl=5000;
    42         input; putlog _infile_;
    45         if (_infile_=:
'WARNING' or _infile_=:
'ERROR') and logonce=0 then 
do;
    46           call symputx(
'logline',_n_);
    51       %
if &logline>0 %then %
do;
    53           infile &logloc lrecl=5000;
    57           if _n_ ge &logline-5 and stoploop=0 then 
do until (i>12);
    58             call symputx(
'logmsg',catx(
'\n',symget(
'logmsg'),_infile_));
    63           if stoploop=1 then stop;
    70       file _webout mod lrecl=32000;
    72       if symexist(
'usermessage') then usermessage=quote(trim(symget('usermessage')));
    73       else usermessage='"blank"';
    74       if symexist('logmessage') then logmessage=quote(trim(symget('logmessage')));
    75       else logmessage='"blank"';
    76       sasdatetime=datetime();
    77       msg=cats(symget('msg'),'\n\nLog Extract:\n',symget('logmsg'));
    79       msg=tranwrd(msg,'"','\"');
    83       msg=cats('"',msg,'"');
    84       if symexist('_debug') then debug=symget('_debug');
    85       if debug=131 then put "--h54s-data-start--";
    86       put '{
"h54sAbort" : [{
';    88       put ' ,
"MAC": 
"' "&mac
" '"}],
';    89       put '"usermessage" : 
' usermessage ',
';    90       put '"logmessage" : 
' logmessage ',
';    91       put '"errormessage" : 
"aborted by mf_abort macro",
';    92       put '"requestingUser" : 
"' "&_metauser.
" '",
';    93       put '"requestingPerson" : 
"' "&_metaperson.
" '",
';    94       put '"executingPid" : 
' "&sysjobid." ',
';    95       put '"sasDatetime" : 
' sasdatetime ',
';    96       put '"status" : 
"success"}
';    97       if debug=131 then put "--h54s-data-end--";    98       rc = stpsrvset('program error
', 0);   101     %if %substr(&sysvlong.,8,2)=M2 %then %do;   102       /* M2 stp server does not cope well with endsas */   104         abort cancel 0 nolist;