56%local dbg mainref authref boundary;
57%let mainref=%mf_getuniquefileref();
58%let authref=%mf_getuniquefileref();
59%let boundary=%mf_getuniquename();
60%
if &inputparams=0 %then %let inputparams=_null_;
62%
if &mdebug=1 %then %
do;
63 %put &sysmacroname entry vars:;
69%mp_abort(iftrue=(
"&pgm"=
"")
71 ,msg=%str(Program not provided)
76%let optval=%sysfunc(getoption(bomfile));
81 file &mainref termstr=crlf lrecl=32767 mod;
82 length line $1000 name $32 value $32767;
83 if _n_=1 then call missing(of _all_);
86 line=cats(
'Content-Disposition: form-data; name="',name,
'"');
96 set &inputfiles end=last;
97 length fileref $8 name $32 filename $256;
98 call symputx(cats(
'webref',_n_),fileref,
'l');
99 call symputx(cats(
'webname',_n_),name,
'l');
100 call symputx(cats(
'webfilename',_n_),filename,
'l');
102 call symputx(
'webcount',_n_);
103 call missing(of _all_);
109%
do i=1 %to &webcount;
111 file &mainref termstr=crlf lrecl=32767 mod;
112 infile &&webref&i lrecl=32767;
116 'Content-Disposition: form-data; name="'
124 put
"Content-Type: text/plain";
133 file &mainref termstr=crlf mod;
138 file &authref lrecl=1000;
139 infile
"&_sasjs_tokenfile" lrecl=1000;
141 if _n_=1 then put
"Content-Type: multipart/form-data; boundary=&boundary";
145%
if &mdebug=1 %then %
do;
158%let resp_path=%sysfunc(pathname(work))/%mf_getuniquename();
159filename &outref
"&resp_path" lrecl=32767;
162proc http method=
'POST' headerin=&authref in=&mainref out=&outref
163 url=
"&_sasjs_apiserverurl.&_sasjs_apipath?_program=&pgm%str(&)_debug=131";
164%
if &mdebug=1 %then %
do;
169%
if (&SYS_PROCHTTP_STATUS_CODE ne 200 and &SYS_PROCHTTP_STATUS_CODE ne 201)
172 data _null_;infile &outref;input;putlog _infile_;run;
175 iftrue=(&SYS_PROCHTTP_STATUS_CODE ne 200 and &SYS_PROCHTTP_STATUS_CODE ne 201)
177 ,msg=%str(&SYS_PROCHTTP_STATUS_CODE &SYS_PROCHTTP_STATUS_PHRASE)
183%
if &outlogds ne _null_ or &mdebug=1 %then %
do;
184 %local matchstr chopout;
185 %let matchstr=SASJS_LOGS_SEPARATOR_163ee17b6ff24f028928972d80a26784;
186 %let chopout=%sysfunc(pathname(work))/%mf_getuniquename(prefix=chop);
188 %mp_chop(
"&resp_path"
197 infile
"&chopout" lrecl=2000;
200 %
if &mdebug=1 %then %
do;
206%
if &mdebug=1 %then %
do;
207 %put &sysmacroname exit vars:;