From 2ec440b321f61082c79475c0c76e1850252e9f29 Mon Sep 17 00:00:00 2001 From: munja Date: Tue, 21 Dec 2021 19:34:08 +0000 Subject: [PATCH] fix: removing termstr=lf as it breaks on SAS 9 deploys --- all.sas | 55 +++++++++++++++++++----------------- base/mp_jsonout.sas | 12 ++++---- meta/mm_createwebservice.sas | 12 ++++---- viya/mv_createwebservice.sas | 12 ++++---- 4 files changed, 47 insertions(+), 44 deletions(-) diff --git a/all.sas b/all.sas index b652c43..baef181 100644 --- a/all.sas +++ b/all.sas @@ -6901,13 +6901,13 @@ filename &tempref clear; %put output location=&jref; %if &action=OPEN %then %do; options nobomfile; - data _null_;file &jref encoding='utf-8'; + data _null_;file &jref encoding='utf-8' ; put '{"PROCESSED_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '"'; run; %end; %else %if (&action=ARR or &action=OBJ) %then %do; options validvarname=upcase; - data _null_;file &jref mod encoding='utf-8'; + data _null_;file &jref mod encoding='utf-8' ; put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":"; %if &engine=PROCJSON %then %do; @@ -6986,7 +6986,7 @@ filename &tempref clear; run; %let ds=&fmtds; %end; /* &fmt=Y */ - data _null_;file &jref mod encoding='utf-8'; + data _null_;file &jref mod encoding='utf-8' ; put "["; call symputx('cols',0,'l'); proc sort data=sashelp.vcolumn(where=(libname='WORK' & memname="%upcase(&ds)")) @@ -7031,7 +7031,7 @@ filename &tempref clear; /* write to temp loc to avoid _webout truncation - https://support.sas.com/kb/49/325.html */ filename _sjs temp lrecl=131068 encoding='utf-8'; - data _null_; file _sjs lrecl=131068 encoding='utf-8' mod; + data _null_; file _sjs lrecl=131068 encoding='utf-8' mod ; set &tempds; if _n_>1 then put "," @; put %if &action=ARR %then "[" ; %else "{" ; @@ -7058,14 +7058,14 @@ filename &tempref clear; rc = fclose(fileid); run; filename _sjs clear; - data _null_; file &jref mod encoding='utf-8'; + data _null_; file &jref mod encoding='utf-8' ; put "]"; run; %end; %end; %else %if &action=CLOSE %then %do; - data _null_;file &jref encoding='utf-8' mod; + data _null_;file &jref encoding='utf-8' mod ; put "}"; run; %end; @@ -11710,13 +11710,13 @@ data _null_; put '%put output location=&jref; '; put '%if &action=OPEN %then %do; '; put ' options nobomfile; '; - put ' data _null_;file &jref encoding=''utf-8''; '; + put ' data _null_;file &jref encoding=''utf-8'' ; '; put ' put ''{"PROCESSED_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''"''; '; put ' run; '; put '%end; '; put '%else %if (&action=ARR or &action=OBJ) %then %do; '; put ' options validvarname=upcase; '; - put ' data _null_;file &jref mod encoding=''utf-8''; '; + put ' data _null_;file &jref mod encoding=''utf-8'' ; '; put ' put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":"; '; put ' '; put ' %if &engine=PROCJSON %then %do; '; @@ -11795,7 +11795,7 @@ data _null_; put ' run; '; put ' %let ds=&fmtds; '; put ' %end; /* &fmt=Y */ '; - put ' data _null_;file &jref mod encoding=''utf-8''; '; + put ' data _null_;file &jref mod encoding=''utf-8'' ; '; put ' put "["; call symputx(''cols'',0,''l''); '; put ' proc sort '; put ' data=sashelp.vcolumn(where=(libname=''WORK'' & memname="%upcase(&ds)")) '; @@ -11840,7 +11840,7 @@ data _null_; put ' /* write to temp loc to avoid _webout truncation '; put ' - https://support.sas.com/kb/49/325.html */ '; put ' filename _sjs temp lrecl=131068 encoding=''utf-8''; '; - put ' data _null_; file _sjs lrecl=131068 encoding=''utf-8'' mod; '; + put ' data _null_; file _sjs lrecl=131068 encoding=''utf-8'' mod ; '; put ' set &tempds; '; put ' if _n_>1 then put "," @; put '; put ' %if &action=ARR %then "[" ; %else "{" ; '; @@ -11867,14 +11867,14 @@ data _null_; put ' rc = fclose(fileid); '; put ' run; '; put ' filename _sjs clear; '; - put ' data _null_; file &jref mod encoding=''utf-8''; '; + put ' data _null_; file &jref mod encoding=''utf-8'' ; '; put ' put "]"; '; put ' run; '; put ' %end; '; put '%end; '; put ' '; put '%else %if &action=CLOSE %then %do; '; - put ' data _null_;file &jref encoding=''utf-8'' mod; '; + put ' data _null_;file &jref encoding=''utf-8'' mod ; '; put ' put "}"; '; put ' run; '; put '%end; '; @@ -15722,7 +15722,7 @@ run; OPTIONS NOBOMFILE; /* setup json */ - data _null_;file &fref encoding='utf-8'; + data _null_;file &fref encoding='utf-8' termstr=lf; %if %str(&_debug) ge 131 %then %do; put '>>weboutBEGIN<<'; %end; @@ -15751,14 +15751,14 @@ run; i+1; call symputx('wt'!!left(i),name,'l'); call symputx('wtcnt',i,'l'); - data _null_; file &fref mod encoding='utf-8'; + data _null_; file &fref mod encoding='utf-8' termstr=lf; put ",""WORK"":{"; %do i=1 %to &wtcnt; %let wt=&&wt&i; proc contents noprint data=&wt out=_data_ (keep=name type length format:); run;%let tempds=%scan(&syslast,2,.); - data _null_; file &fref mod encoding='utf-8'; + data _null_; file &fref mod encoding='utf-8' termstr=lf; dsid=open("WORK.&wt",'is'); nlobs=attrn(dsid,'NLOBS'); nvars=attrn(dsid,'NVARS'); @@ -15769,15 +15769,15 @@ run; put ',"nvars":' nvars; %mp_jsonout(OBJ,&tempds,jref=&fref,dslabel=colattrs,engine=DATASTEP) %mp_jsonout(OBJ,&wt,jref=&fref,dslabel=first10rows,engine=DATASTEP) - data _null_; file &fref mod encoding='utf-8'; + data _null_; file &fref mod encoding='utf-8' termstr=lf; put "}"; %end; - data _null_; file &fref mod encoding='utf-8'; + data _null_; file &fref mod encoding='utf-8' termstr=lf termstr=lf; put "}"; run; %end; /* close off json */ - data _null_;file &fref mod encoding='utf-8'; + data _null_;file &fref mod encoding='utf-8' termstr=lf; _PROGRAM=quote(trim(resolve(symget('_PROGRAM')))); put ",""SYSUSERID"" : ""&sysuserid"" "; put ",""MF_GETUSER"" : ""%mf_getuser()"" "; @@ -15790,7 +15790,9 @@ run; put ",""SYSHOSTNAME"" : ""&syshostname"" "; put ",""SYSPROCESSID"" : ""&SYSPROCESSID"" "; put ",""SYSPROCESSMODE"" : ""&SYSPROCESSMODE"" "; - put ",""SYSPROCESSNAME"" : ""&SYSPROCESSNAME"" "; + length SYSPROCESSNAME $512; + SYSPROCESSNAME=quote(urlencode(cats(SYSPROCESSNAME))); + put ",""SYSPROCESSNAME"" : " SYSPROCESSNAME; put ",""SYSJOBID"" : ""&sysjobid"" "; put ",""SYSSCPL"" : ""&sysscpl"" "; put ",""SYSSITE"" : ""&syssite"" "; @@ -15799,7 +15801,8 @@ run; put ',"SYSVLONG" : ' sysvlong; put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" "; put ',"END_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '" '; - autoexec=quote(trim(getoption('autoexec'))); + length autoexec $512; + autoexec=quote(urlencode(trim(getoption('autoexec')))); put ',"AUTOEXEC" : ' autoexec; memsize="%sysfunc(INPUTN(%sysfunc(getoption(memsize)), best.),sizekmg.)"; memsize=quote(cats(memsize)); @@ -16791,13 +16794,13 @@ data _null_; put '%put output location=&jref; '; put '%if &action=OPEN %then %do; '; put ' options nobomfile; '; - put ' data _null_;file &jref encoding=''utf-8''; '; + put ' data _null_;file &jref encoding=''utf-8'' ; '; put ' put ''{"PROCESSED_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''"''; '; put ' run; '; put '%end; '; put '%else %if (&action=ARR or &action=OBJ) %then %do; '; put ' options validvarname=upcase; '; - put ' data _null_;file &jref mod encoding=''utf-8''; '; + put ' data _null_;file &jref mod encoding=''utf-8'' ; '; put ' put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":"; '; put ' '; put ' %if &engine=PROCJSON %then %do; '; @@ -16876,7 +16879,7 @@ data _null_; put ' run; '; put ' %let ds=&fmtds; '; put ' %end; /* &fmt=Y */ '; - put ' data _null_;file &jref mod encoding=''utf-8''; '; + put ' data _null_;file &jref mod encoding=''utf-8'' ; '; put ' put "["; call symputx(''cols'',0,''l''); '; put ' proc sort '; put ' data=sashelp.vcolumn(where=(libname=''WORK'' & memname="%upcase(&ds)")) '; @@ -16921,7 +16924,7 @@ data _null_; put ' /* write to temp loc to avoid _webout truncation '; put ' - https://support.sas.com/kb/49/325.html */ '; put ' filename _sjs temp lrecl=131068 encoding=''utf-8''; '; - put ' data _null_; file _sjs lrecl=131068 encoding=''utf-8'' mod; '; + put ' data _null_; file _sjs lrecl=131068 encoding=''utf-8'' mod ; '; put ' set &tempds; '; put ' if _n_>1 then put "," @; put '; put ' %if &action=ARR %then "[" ; %else "{" ; '; @@ -16948,14 +16951,14 @@ data _null_; put ' rc = fclose(fileid); '; put ' run; '; put ' filename _sjs clear; '; - put ' data _null_; file &jref mod encoding=''utf-8''; '; + put ' data _null_; file &jref mod encoding=''utf-8'' ; '; put ' put "]"; '; put ' run; '; put ' %end; '; put '%end; '; put ' '; put '%else %if &action=CLOSE %then %do; '; - put ' data _null_;file &jref encoding=''utf-8'' mod; '; + put ' data _null_;file &jref encoding=''utf-8'' mod ; '; put ' put "}"; '; put ' run; '; put '%end; '; diff --git a/base/mp_jsonout.sas b/base/mp_jsonout.sas index 8179563..f6b98fd 100644 --- a/base/mp_jsonout.sas +++ b/base/mp_jsonout.sas @@ -62,13 +62,13 @@ %put output location=&jref; %if &action=OPEN %then %do; options nobomfile; - data _null_;file &jref encoding='utf-8' termstr=lf; + data _null_;file &jref encoding='utf-8' ; put '{"PROCESSED_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '"'; run; %end; %else %if (&action=ARR or &action=OBJ) %then %do; options validvarname=upcase; - data _null_;file &jref mod encoding='utf-8' termstr=lf; + data _null_;file &jref mod encoding='utf-8' ; put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":"; %if &engine=PROCJSON %then %do; @@ -147,7 +147,7 @@ run; %let ds=&fmtds; %end; /* &fmt=Y */ - data _null_;file &jref mod encoding='utf-8' termstr=lf; + data _null_;file &jref mod encoding='utf-8' ; put "["; call symputx('cols',0,'l'); proc sort data=sashelp.vcolumn(where=(libname='WORK' & memname="%upcase(&ds)")) @@ -192,7 +192,7 @@ /* write to temp loc to avoid _webout truncation - https://support.sas.com/kb/49/325.html */ filename _sjs temp lrecl=131068 encoding='utf-8'; - data _null_; file _sjs lrecl=131068 encoding='utf-8' mod termstr=lf; + data _null_; file _sjs lrecl=131068 encoding='utf-8' mod ; set &tempds; if _n_>1 then put "," @; put %if &action=ARR %then "[" ; %else "{" ; @@ -219,14 +219,14 @@ rc = fclose(fileid); run; filename _sjs clear; - data _null_; file &jref mod encoding='utf-8' termstr=lf; + data _null_; file &jref mod encoding='utf-8' ; put "]"; run; %end; %end; %else %if &action=CLOSE %then %do; - data _null_;file &jref encoding='utf-8' mod termstr=lf; + data _null_;file &jref encoding='utf-8' mod ; put "}"; run; %end; diff --git a/meta/mm_createwebservice.sas b/meta/mm_createwebservice.sas index d7bbdd3..99c2ad1 100644 --- a/meta/mm_createwebservice.sas +++ b/meta/mm_createwebservice.sas @@ -94,13 +94,13 @@ data _null_; put '%put output location=&jref; '; put '%if &action=OPEN %then %do; '; put ' options nobomfile; '; - put ' data _null_;file &jref encoding=''utf-8''; '; + put ' data _null_;file &jref encoding=''utf-8'' ; '; put ' put ''{"PROCESSED_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''"''; '; put ' run; '; put '%end; '; put '%else %if (&action=ARR or &action=OBJ) %then %do; '; put ' options validvarname=upcase; '; - put ' data _null_;file &jref mod encoding=''utf-8''; '; + put ' data _null_;file &jref mod encoding=''utf-8'' ; '; put ' put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":"; '; put ' '; put ' %if &engine=PROCJSON %then %do; '; @@ -179,7 +179,7 @@ data _null_; put ' run; '; put ' %let ds=&fmtds; '; put ' %end; /* &fmt=Y */ '; - put ' data _null_;file &jref mod encoding=''utf-8''; '; + put ' data _null_;file &jref mod encoding=''utf-8'' ; '; put ' put "["; call symputx(''cols'',0,''l''); '; put ' proc sort '; put ' data=sashelp.vcolumn(where=(libname=''WORK'' & memname="%upcase(&ds)")) '; @@ -224,7 +224,7 @@ data _null_; put ' /* write to temp loc to avoid _webout truncation '; put ' - https://support.sas.com/kb/49/325.html */ '; put ' filename _sjs temp lrecl=131068 encoding=''utf-8''; '; - put ' data _null_; file _sjs lrecl=131068 encoding=''utf-8'' mod; '; + put ' data _null_; file _sjs lrecl=131068 encoding=''utf-8'' mod ; '; put ' set &tempds; '; put ' if _n_>1 then put "," @; put '; put ' %if &action=ARR %then "[" ; %else "{" ; '; @@ -251,14 +251,14 @@ data _null_; put ' rc = fclose(fileid); '; put ' run; '; put ' filename _sjs clear; '; - put ' data _null_; file &jref mod encoding=''utf-8''; '; + put ' data _null_; file &jref mod encoding=''utf-8'' ; '; put ' put "]"; '; put ' run; '; put ' %end; '; put '%end; '; put ' '; put '%else %if &action=CLOSE %then %do; '; - put ' data _null_;file &jref encoding=''utf-8'' mod; '; + put ' data _null_;file &jref encoding=''utf-8'' mod ; '; put ' put "}"; '; put ' run; '; put '%end; '; diff --git a/viya/mv_createwebservice.sas b/viya/mv_createwebservice.sas index 6ba39c1..721f106 100644 --- a/viya/mv_createwebservice.sas +++ b/viya/mv_createwebservice.sas @@ -242,13 +242,13 @@ data _null_; put '%put output location=&jref; '; put '%if &action=OPEN %then %do; '; put ' options nobomfile; '; - put ' data _null_;file &jref encoding=''utf-8''; '; + put ' data _null_;file &jref encoding=''utf-8'' ; '; put ' put ''{"PROCESSED_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''"''; '; put ' run; '; put '%end; '; put '%else %if (&action=ARR or &action=OBJ) %then %do; '; put ' options validvarname=upcase; '; - put ' data _null_;file &jref mod encoding=''utf-8''; '; + put ' data _null_;file &jref mod encoding=''utf-8'' ; '; put ' put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":"; '; put ' '; put ' %if &engine=PROCJSON %then %do; '; @@ -327,7 +327,7 @@ data _null_; put ' run; '; put ' %let ds=&fmtds; '; put ' %end; /* &fmt=Y */ '; - put ' data _null_;file &jref mod encoding=''utf-8''; '; + put ' data _null_;file &jref mod encoding=''utf-8'' ; '; put ' put "["; call symputx(''cols'',0,''l''); '; put ' proc sort '; put ' data=sashelp.vcolumn(where=(libname=''WORK'' & memname="%upcase(&ds)")) '; @@ -372,7 +372,7 @@ data _null_; put ' /* write to temp loc to avoid _webout truncation '; put ' - https://support.sas.com/kb/49/325.html */ '; put ' filename _sjs temp lrecl=131068 encoding=''utf-8''; '; - put ' data _null_; file _sjs lrecl=131068 encoding=''utf-8'' mod; '; + put ' data _null_; file _sjs lrecl=131068 encoding=''utf-8'' mod ; '; put ' set &tempds; '; put ' if _n_>1 then put "," @; put '; put ' %if &action=ARR %then "[" ; %else "{" ; '; @@ -399,14 +399,14 @@ data _null_; put ' rc = fclose(fileid); '; put ' run; '; put ' filename _sjs clear; '; - put ' data _null_; file &jref mod encoding=''utf-8''; '; + put ' data _null_; file &jref mod encoding=''utf-8'' ; '; put ' put "]"; '; put ' run; '; put ' %end; '; put '%end; '; put ' '; put '%else %if &action=CLOSE %then %do; '; - put ' data _null_;file &jref encoding=''utf-8'' mod; '; + put ' data _null_;file &jref encoding=''utf-8'' mod ; '; put ' put "}"; '; put ' run; '; put '%end; ';