49%
if not(%eval(%unquote(&iftrue))) %then %
return;
51%let contentype=%upcase(&contenttype);
52%let outref=%upcase(&outref);
53%local platform; %let platform=%mf_getplatform();
62 set sashelp.vextfl(where=(upcase(fileref)=
"&outref"));
63 if xengine=
'STREAM' then call symputx(
'streamweb',1,
'l');
66%
if &contentype=CSV %then %
do;
67 %
if (&platform=SASMETA and &streamweb=1) %then %
do;
69 rc=stpsrv_header(
'Content-Type',
'application/csv');
70 rc=stpsrv_header(
'Content-disposition',
"attachment; filename=&outname");
73 %
else %
if &platform=SASVIYA %then %
do;
74 filename &outref filesrvc parenturi=
"&SYS_JES_JOB_URI" name=
'_webout.txt'
75 contenttype=
'application/csv'
76 contentdisp=
"attachment; filename=&outname";
78 %
else %
if &platform=SASJS %then %
do;
79 %mfs_httpheader(Content-Type,application/csv)
80 %mfs_httpheader(Content-disposition,%str(attachment; filename=&outname))
83%
else %
if &contentype=EXCEL %then %
do;
85 %
if (&platform=SASMETA and &streamweb=1) %then %
do;
87 rc=stpsrv_header(
'Content-Type',
'application/vnd.ms-excel');
88 rc=stpsrv_header(
'Content-disposition',
"attachment; filename=&outname");
91 %
else %
if &platform=SASVIYA %then %
do;
92 filename &outref filesrvc parenturi=
"&SYS_JES_JOB_URI" name=
'_webout.xls'
93 contenttype=
'application/vnd.ms-excel'
94 contentdisp=
"attachment; filename=&outname";
96 %
else %
if &platform=SASJS %then %
do;
97 %mfs_httpheader(Content-Type,application/vnd.ms-excel)
98 %mfs_httpheader(Content-disposition,%str(attachment; filename=&outname))
101%
else %
if &contentype=GIF or &contentype=JPEG or &contentype=PNG %then %
do;
102 %
if (&platform=SASMETA and &streamweb=1) %then %
do;
104 rc=stpsrv_header(
'Content-Type',
"image/%lowcase(&contenttype)");
107 %
else %
if &platform=SASVIYA %then %
do;
108 filename &outref filesrvc parenturi=
"&SYS_JES_JOB_URI"
109 contenttype=
"image/%lowcase(&contenttype)";
111 %
else %
if &platform=SASJS %then %
do;
112 %mfs_httpheader(Content-Type,image/%lowcase(&contenttype))
115%
else %
if &contentype=HTML or &contenttype=MARKDOWN %then %
do;
116 %
if (&platform=SASMETA and &streamweb=1) %then %
do;
118 rc=stpsrv_header(
'Content-Type',
"text/%lowcase(&contenttype)");
119 rc=stpsrv_header(
'Content-disposition',
"attachment; filename=&outname");
122 %
else %
if &platform=SASVIYA %then %
do;
123 filename &outref filesrvc parenturi=
"&SYS_JES_JOB_URI" name=
"_webout.json"
124 contenttype=
"text/%lowcase(&contenttype)"
125 contentdisp=
"attachment; filename=&outname";
127 %
else %
if &platform=SASJS %then %
do;
128 %mfs_httpheader(Content-Type,text/%lowcase(&contenttype))
129 %mfs_httpheader(Content-disposition,%str(attachment; filename=&outname))
132%
else %
if &contentype=TEXT %then %
do;
133 %
if (&platform=SASMETA and &streamweb=1) %then %
do;
135 rc=stpsrv_header(
'Content-Type',
'application/text');
136 rc=stpsrv_header(
'Content-disposition',
"attachment; filename=&outname");
139 %
else %
if &platform=SASVIYA %then %
do;
140 filename &outref filesrvc parenturi=
"&SYS_JES_JOB_URI" name=
'_webout.txt'
141 contenttype=
'application/text'
142 contentdisp=
"attachment; filename=&outname";
144 %
else %
if &platform=SASJS %then %
do;
145 %mfs_httpheader(Content-Type,application/text)
146 %mfs_httpheader(Content-disposition,%str(attachment; filename=&outname))
149%
else %
if &contentype=WOFF or &contentype=WOFF2 or &contentype=TTF %then %
do;
150 %
if (&platform=SASMETA and &streamweb=1) %then %
do;
152 rc=stpsrv_header(
'Content-Type',
"font/%lowcase(&contenttype)");
155 %
else %
if &platform=SASVIYA %then %
do;
156 filename &outref filesrvc parenturi=
"&SYS_JES_JOB_URI"
157 contenttype=
"font/%lowcase(&contenttype)";
159 %
else %
if &platform=SASJS %then %
do;
160 %mfs_httpheader(Content-Type,font/%lowcase(&contenttype))
163%
else %
if &contentype=XLSX %then %
do;
164 %
if (&platform=SASMETA and &streamweb=1) %then %
do;
166 rc=stpsrv_header(
'Content-Type',
167 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
168 rc=stpsrv_header(
'Content-disposition',
"attachment; filename=&outname");
171 %
else %
if &platform=SASVIYA %then %
do;
172 filename &outref filesrvc parenturi=
"&SYS_JES_JOB_URI" name=
'_webout.xls'
174 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
175 contentdisp=
"attachment; filename=&outname";
177 %
else %
if &platform=SASJS %then %
do;
178 %mfs_httpheader(Content-Type
179 ,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
181 %mfs_httpheader(Content-disposition,%str(attachment; filename=&outname))
184%
else %
if &contentype=ZIP %then %
do;
185 %
if (&platform=SASMETA and &streamweb=1) %then %
do;
187 rc=stpsrv_header(
'Content-Type',
'application/zip');
188 rc=stpsrv_header(
'Content-disposition',
"attachment; filename=&outname");
191 %
else %
if &platform=SASVIYA %then %
do;
192 filename &outref filesrvc parenturi=
"&SYS_JES_JOB_URI" name=
'_webout.zip'
193 contenttype=
'application/zip'
194 contentdisp=
"attachment; filename=&outname";
196 %
else %
if &platform=SASJS %then %
do;
197 %mfs_httpheader(Content-Type,application/zip)
198 %mfs_httpheader(Content-disposition,%str(attachment; filename=&outname))
202 %put %str(ERR)OR: Content Type &contenttype NOT SUPPORTED by &sysmacroname!;
205%
if &inref ne 0 %then %
do;
206 %mp_binarycopy(inref=&inref,outref=&outref)
209 %mp_binarycopy(inloc=
"&inloc",outref=&outref)