From abfe7fe339db3a2dbff9d85ff4f4eab3561d8e97 Mon Sep 17 00:00:00 2001 From: Allan Bowe Date: Tue, 7 Jun 2022 11:28:59 +0000 Subject: [PATCH] fix: no json wrapper in SASjs mode in mp_abort.sas --- all.sas | 9 ++++++--- base/mp_abort.sas | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/all.sas b/all.sas index 0474ab1..894b28a 100644 --- a/all.sas +++ b/all.sas @@ -2356,7 +2356,7 @@ Usage: /* send response in SASjs JSON format */ data _null_; file _webout mod lrecl=32000 encoding='utf-8'; - length msg syswarningtext syserrortext $32767 ; + length msg syswarningtext syserrortext $32767 mode $10 ; sasdatetime=datetime(); msg=symget('msg'); %if &logline>0 %then %do; @@ -2372,7 +2372,10 @@ Usage: msg=cats('"',msg,'"'); if symexist('_debug') then debug=quote(trim(symget('_debug'))); else debug='""'; - put '>>weboutBEGIN<<'; + if symexist('sasjsprocessmode') + and symget('sasjsprocessmode')='Stored Program' + then mode='SASJS'; + if mode ne 'SASJS' then put '>>weboutBEGIN<<'; put '{"SYSDATE" : "' "&SYSDATE" '"'; put ',"SYSTIME" : "' "&SYSTIME" '"'; put ',"sasjsAbort" : [{'; @@ -2405,7 +2408,7 @@ Usage: put ",""SYSWARNINGTEXT"" : " syswarningtext; put ',"END_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '" '; put "}" @; - put '>>weboutEND<<'; + if mode ne 'SASJS' then put '>>weboutEND<<'; run; %put _all_; diff --git a/base/mp_abort.sas b/base/mp_abort.sas index df497db..bb04cc8 100644 --- a/base/mp_abort.sas +++ b/base/mp_abort.sas @@ -171,7 +171,7 @@ /* send response in SASjs JSON format */ data _null_; file _webout mod lrecl=32000 encoding='utf-8'; - length msg syswarningtext syserrortext $32767 ; + length msg syswarningtext syserrortext $32767 mode $10 ; sasdatetime=datetime(); msg=symget('msg'); %if &logline>0 %then %do; @@ -187,7 +187,10 @@ msg=cats('"',msg,'"'); if symexist('_debug') then debug=quote(trim(symget('_debug'))); else debug='""'; - put '>>weboutBEGIN<<'; + if symexist('sasjsprocessmode') + and symget('sasjsprocessmode')='Stored Program' + then mode='SASJS'; + if mode ne 'SASJS' then put '>>weboutBEGIN<<'; put '{"SYSDATE" : "' "&SYSDATE" '"'; put ',"SYSTIME" : "' "&SYSTIME" '"'; put ',"sasjsAbort" : [{'; @@ -220,7 +223,7 @@ put ",""SYSWARNINGTEXT"" : " syswarningtext; put ',"END_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '" '; put "}" @; - put '>>weboutEND<<'; + if mode ne 'SASJS' then put '>>weboutEND<<'; run; %put _all_;