From 532bf84e069f4da8e3be03bfe7ea7911397c6ce7 Mon Sep 17 00:00:00 2001 From: Allan Bowe Date: Sat, 25 Jun 2022 21:38:05 +0000 Subject: [PATCH] fix: mp_jsonout --- all.sas | 96 ++++++++++++++-------------------- base/mp_jsonout.sas | 24 ++++----- meta/mm_createwebservice.sas | 24 ++++----- server/ms_createwebservice.sas | 24 ++++----- viya/mv_createwebservice.sas | 24 ++++----- 5 files changed, 80 insertions(+), 112 deletions(-) diff --git a/all.sas b/all.sas index 7a5d2cf..4b9e42a 100644 --- a/all.sas +++ b/all.sas @@ -8814,20 +8814,16 @@ options %if &action=ARR %then "]" ; %else "}" ; ; /* now write the long strings to _webout 1 byte at a time */ data _null_; - length filein 8 fileid 8; - filein=fopen("_sjs",'I',1,'B'); - fileid=fopen("&jref",'A',1,'B'); - rec='20'x; - do while(fread(filein)=0); - rc=fget(filein,rec,1); - rc=fput(fileid, rec); - rc=fwrite(fileid); - end; - /* close out the table */ - rc=fput(fileid, "]"); - rc=fwrite(fileid); - rc=fclose(filein); - rc=fclose(fileid); + infile _sjs; + file &jref mod; + input sourcechar $char1. @@; + format sourcechar hex2.; + put sourcechar char1. @@; + run; + /* close out the table */ + data _null_; + file &jref mod; + put ']'; run; filename _sjs clear; %end; @@ -15195,20 +15191,16 @@ data _null_; put ' %if &action=ARR %then "]" ; %else "}" ; ; '; put ' /* now write the long strings to _webout 1 byte at a time */ '; put ' data _null_; '; - put ' length filein 8 fileid 8; '; - put ' filein=fopen("_sjs",''I'',1,''B''); '; - put ' fileid=fopen("&jref",''A'',1,''B''); '; - put ' rec=''20''x; '; - put ' do while(fread(filein)=0); '; - put ' rc=fget(filein,rec,1); '; - put ' rc=fput(fileid, rec); '; - put ' rc=fwrite(fileid); '; - put ' end; '; - put ' /* close out the table */ '; - put ' rc=fput(fileid, "]"); '; - put ' rc=fwrite(fileid); '; - put ' rc=fclose(filein); '; - put ' rc=fclose(fileid); '; + put ' infile _sjs; '; + put ' file &jref mod; '; + put ' input sourcechar $char1. @@; '; + put ' format sourcechar hex2.; '; + put ' put sourcechar char1. @@; '; + put ' run; '; + put ' /* close out the table */ '; + put ' data _null_; '; + put ' file &jref mod; '; + put ' put '']''; '; put ' run; '; put ' filename _sjs clear; '; put ' %end; '; @@ -19932,20 +19924,16 @@ data _null_; put ' %if &action=ARR %then "]" ; %else "}" ; ; '; put ' /* now write the long strings to _webout 1 byte at a time */ '; put ' data _null_; '; - put ' length filein 8 fileid 8; '; - put ' filein=fopen("_sjs",''I'',1,''B''); '; - put ' fileid=fopen("&jref",''A'',1,''B''); '; - put ' rec=''20''x; '; - put ' do while(fread(filein)=0); '; - put ' rc=fget(filein,rec,1); '; - put ' rc=fput(fileid, rec); '; - put ' rc=fwrite(fileid); '; - put ' end; '; - put ' /* close out the table */ '; - put ' rc=fput(fileid, "]"); '; - put ' rc=fwrite(fileid); '; - put ' rc=fclose(filein); '; - put ' rc=fclose(fileid); '; + put ' infile _sjs; '; + put ' file &jref mod; '; + put ' input sourcechar $char1. @@; '; + put ' format sourcechar hex2.; '; + put ' put sourcechar char1. @@; '; + put ' run; '; + put ' /* close out the table */ '; + put ' data _null_; '; + put ' file &jref mod; '; + put ' put '']''; '; put ' run; '; put ' filename _sjs clear; '; put ' %end; '; @@ -22277,20 +22265,16 @@ data _null_; put ' %if &action=ARR %then "]" ; %else "}" ; ; '; put ' /* now write the long strings to _webout 1 byte at a time */ '; put ' data _null_; '; - put ' length filein 8 fileid 8; '; - put ' filein=fopen("_sjs",''I'',1,''B''); '; - put ' fileid=fopen("&jref",''A'',1,''B''); '; - put ' rec=''20''x; '; - put ' do while(fread(filein)=0); '; - put ' rc=fget(filein,rec,1); '; - put ' rc=fput(fileid, rec); '; - put ' rc=fwrite(fileid); '; - put ' end; '; - put ' /* close out the table */ '; - put ' rc=fput(fileid, "]"); '; - put ' rc=fwrite(fileid); '; - put ' rc=fclose(filein); '; - put ' rc=fclose(fileid); '; + put ' infile _sjs; '; + put ' file &jref mod; '; + put ' input sourcechar $char1. @@; '; + put ' format sourcechar hex2.; '; + put ' put sourcechar char1. @@; '; + put ' run; '; + put ' /* close out the table */ '; + put ' data _null_; '; + put ' file &jref mod; '; + put ' put '']''; '; put ' run; '; put ' filename _sjs clear; '; put ' %end; '; diff --git a/base/mp_jsonout.sas b/base/mp_jsonout.sas index 5760613..4caee28 100644 --- a/base/mp_jsonout.sas +++ b/base/mp_jsonout.sas @@ -236,20 +236,16 @@ %if &action=ARR %then "]" ; %else "}" ; ; /* now write the long strings to _webout 1 byte at a time */ data _null_; - length filein 8 fileid 8; - filein=fopen("_sjs",'I',1,'B'); - fileid=fopen("&jref",'A',1,'B'); - rec='20'x; - do while(fread(filein)=0); - rc=fget(filein,rec,1); - rc=fput(fileid, rec); - rc=fwrite(fileid); - end; - /* close out the table */ - rc=fput(fileid, "]"); - rc=fwrite(fileid); - rc=fclose(filein); - rc=fclose(fileid); + infile _sjs; + file &jref mod; + input sourcechar $char1. @@; + format sourcechar hex2.; + put sourcechar char1. @@; + run; + /* close out the table */ + data _null_; + file &jref mod; + put ']'; run; filename _sjs clear; %end; diff --git a/meta/mm_createwebservice.sas b/meta/mm_createwebservice.sas index a2d8700..d4f6220 100644 --- a/meta/mm_createwebservice.sas +++ b/meta/mm_createwebservice.sas @@ -270,20 +270,16 @@ data _null_; put ' %if &action=ARR %then "]" ; %else "}" ; ; '; put ' /* now write the long strings to _webout 1 byte at a time */ '; put ' data _null_; '; - put ' length filein 8 fileid 8; '; - put ' filein=fopen("_sjs",''I'',1,''B''); '; - put ' fileid=fopen("&jref",''A'',1,''B''); '; - put ' rec=''20''x; '; - put ' do while(fread(filein)=0); '; - put ' rc=fget(filein,rec,1); '; - put ' rc=fput(fileid, rec); '; - put ' rc=fwrite(fileid); '; - put ' end; '; - put ' /* close out the table */ '; - put ' rc=fput(fileid, "]"); '; - put ' rc=fwrite(fileid); '; - put ' rc=fclose(filein); '; - put ' rc=fclose(fileid); '; + put ' infile _sjs; '; + put ' file &jref mod; '; + put ' input sourcechar $char1. @@; '; + put ' format sourcechar hex2.; '; + put ' put sourcechar char1. @@; '; + put ' run; '; + put ' /* close out the table */ '; + put ' data _null_; '; + put ' file &jref mod; '; + put ' put '']''; '; put ' run; '; put ' filename _sjs clear; '; put ' %end; '; diff --git a/server/ms_createwebservice.sas b/server/ms_createwebservice.sas index 79a8a56..cd7ca4d 100644 --- a/server/ms_createwebservice.sas +++ b/server/ms_createwebservice.sas @@ -271,20 +271,16 @@ data _null_; put ' %if &action=ARR %then "]" ; %else "}" ; ; '; put ' /* now write the long strings to _webout 1 byte at a time */ '; put ' data _null_; '; - put ' length filein 8 fileid 8; '; - put ' filein=fopen("_sjs",''I'',1,''B''); '; - put ' fileid=fopen("&jref",''A'',1,''B''); '; - put ' rec=''20''x; '; - put ' do while(fread(filein)=0); '; - put ' rc=fget(filein,rec,1); '; - put ' rc=fput(fileid, rec); '; - put ' rc=fwrite(fileid); '; - put ' end; '; - put ' /* close out the table */ '; - put ' rc=fput(fileid, "]"); '; - put ' rc=fwrite(fileid); '; - put ' rc=fclose(filein); '; - put ' rc=fclose(fileid); '; + put ' infile _sjs; '; + put ' file &jref mod; '; + put ' input sourcechar $char1. @@; '; + put ' format sourcechar hex2.; '; + put ' put sourcechar char1. @@; '; + put ' run; '; + put ' /* close out the table */ '; + put ' data _null_; '; + put ' file &jref mod; '; + put ' put '']''; '; put ' run; '; put ' filename _sjs clear; '; put ' %end; '; diff --git a/viya/mv_createwebservice.sas b/viya/mv_createwebservice.sas index 22f7796..56e2929 100644 --- a/viya/mv_createwebservice.sas +++ b/viya/mv_createwebservice.sas @@ -413,20 +413,16 @@ data _null_; put ' %if &action=ARR %then "]" ; %else "}" ; ; '; put ' /* now write the long strings to _webout 1 byte at a time */ '; put ' data _null_; '; - put ' length filein 8 fileid 8; '; - put ' filein=fopen("_sjs",''I'',1,''B''); '; - put ' fileid=fopen("&jref",''A'',1,''B''); '; - put ' rec=''20''x; '; - put ' do while(fread(filein)=0); '; - put ' rc=fget(filein,rec,1); '; - put ' rc=fput(fileid, rec); '; - put ' rc=fwrite(fileid); '; - put ' end; '; - put ' /* close out the table */ '; - put ' rc=fput(fileid, "]"); '; - put ' rc=fwrite(fileid); '; - put ' rc=fclose(filein); '; - put ' rc=fclose(fileid); '; + put ' infile _sjs; '; + put ' file &jref mod; '; + put ' input sourcechar $char1. @@; '; + put ' format sourcechar hex2.; '; + put ' put sourcechar char1. @@; '; + put ' run; '; + put ' /* close out the table */ '; + put ' data _null_; '; + put ' file &jref mod; '; + put ' put '']''; '; put ' run; '; put ' filename _sjs clear; '; put ' %end; ';