Skip to content

Commit

Permalink
Merge pull request #345 from sasjs/weboutfix
Browse files Browse the repository at this point in the history
fix: missing param in webout of SASjs Server and Viya
  • Loading branch information
allanbowe authored Jul 24, 2023
2 parents 76a2083 + 73f919f commit 91a2d90
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 36 deletions.
40 changes: 22 additions & 18 deletions all.sas
Original file line number Diff line number Diff line change
Expand Up @@ -2904,15 +2904,15 @@ data &outds;
if libref(lib) ne 0 then do;
msg=catx(' ','libref',lib,'is not assigned!');
%if &errds=0 %then %do;
putlog "%str(ERR)OR: " msg;
putlog 'ERR' +(-1) "OR: " msg;
%end;
output;
return;
end;
if exist(cats(lib,'.',ds)) ne 1 then do;
msg=catx(' ','libds',lib,'.',ds,'does not exist!');
%if &errds=0 %then %do;
putlog "%str(ERR)OR: " msg;
putlog 'ERR' +(-1) "OR: " msg;
%end;
output;
return;
Expand All @@ -2921,7 +2921,7 @@ data &outds;
if is_fmt=0 then do;
msg=catx(' ','format',fmt,'on libds',lib,'.',ds,'.',var,'is not valid!');
%if &errds=0 %then %do;
putlog "%str(ERR)OR: " msg;
putlog 'ERR' +(-1) "OR: " msg;
%end;
output;
return;
Expand All @@ -2933,15 +2933,15 @@ data &outds;
if dsid=0 then do;
msg=catx(' ','libds',lib,'.',ds,' could not be opened!');
%if &errds=0 %then %do;
putlog "%str(ERR)OR: " msg;
putlog 'ERR' +(-1) "OR: " msg;
%end;
output;
return;
end;
if varnum(dsid,var)<1 then do;
msg=catx(' ','Variable',lib,'.',ds,'.',var,' was not found!');
%if &errds=0 %then %do;
putlog "%str(ERR)OR: " msg;
putlog 'ERR' +(-1) "OR: " msg;
%end;
output;
end;
Expand Down Expand Up @@ -4255,7 +4255,7 @@ drop table &ddlds,&cntlds;
rc2=filename(fref2,filepath2,'disk','recfm=n');
if fcopy(fref1,fref2) ne 0 then do;
msg=sysmsg();
putlog "%str(ERR)OR: Unable to copy " filepath " to " filepath2;
putlog 'ERR' +(-1) "OR: Unable to copy " filepath " to " filepath2;
putlog msg=;
end;
end;
Expand Down Expand Up @@ -13734,7 +13734,7 @@ alter table &libds modify &var char(&len);
retain &tempcol;
&tempcol=prxparse('/^[_a-z]\w{0,7}\.[_a-z]\w{0,31}$/i');
if missing(&tempcol) then do;
putlog "%str(ERR)OR: Invalid expression for LIBDS";
putlog 'ERR' +(-1) "OR: Invalid expression for LIBDS";
stop;
end;
drop &tempcol;
Expand All @@ -13748,7 +13748,7 @@ alter table &libds modify &var char(&len);
retain &tempcol;
&tempcol=prxparse('/^[_a-z\$]\w{0,31}\.[0-9]*$/i');
if missing(&tempcol) then do;
putlog "%str(ERR)OR: Invalid expression for FORMAT";
putlog 'ERR' +(-1) "OR: Invalid expression for FORMAT";
stop;
end;
drop &tempcol;
Expand Down Expand Up @@ -15268,12 +15268,12 @@ data _null_;

* name must not be blank;
if ( folderPath = '' ) then do;
put "%str(ERR)OR: &sysmacroname PATH parameter value must be non-blank";
put 'ERR' +(-1) "OR: &sysmacroname PATH parameter value must be non-blank";
end;

* must have a starting slash ;
if ( substr(folderPath,1,1) ne '/' ) then do;
put "%str(ERR)OR: &sysmacroname PATH param value must have starting slash";
put 'ERR' +(-1) "OR: &sysmacroname PATH param value must have starting slash";
stop;
end;

Expand All @@ -15286,14 +15286,14 @@ data _null_;

* do not create a root (one level) folder ;
if countc(folderPath,'/')=1 then do;
put "%str(ERR)OR: &sysmacroname will not create a new ROOT folder";
put 'ERR' +(-1) "OR: &sysmacroname will not create a new ROOT folder";
stop;
end;

* check that root folder exists ;
root=cats('/',scan(folderpath,1,'/'),"(Folder)");
if metadata_pathobj('',root,"",objType,parentId)<1 then do;
put "%str(ERR)OR: " root " does not exist!";
put 'ERR' +(-1) "OR: " root " does not exist!";
stop;
end;

Expand Down Expand Up @@ -15358,7 +15358,7 @@ run;
putlog "SUCCCESS! &path created.";
end;
else do;
putlog "%str(ERR)OR: unsuccessful attempt to create &path";
putlog 'ERR' +(-1) "OR: unsuccessful attempt to create &path";
call symputx('syscc',8);
end;
run;
Expand Down Expand Up @@ -18737,7 +18737,7 @@ data &outds;
rc5=metadata_getattr(tsuri,"Name",servercontext);
end;
else do;
put "%str(ERR)OR: could not find " path;
put 'ERR' +(-1) "OR: could not find " path;
put (_all_)(=);
end;
&md.put (_all_)(=);
Expand Down Expand Up @@ -21845,9 +21845,11 @@ data _null_;
put ' ';
put '%mend mfs_httpheader; ';
/* WEBOUT END */
put '%macro webout(action,ds,dslabel=,fmt=,missing=NULL,showmeta=NO);';
put '%macro webout(action,ds,dslabel=,fmt=,missing=NULL,showmeta=NO';
put ' ,maxobs=MAX';
put ');';
put ' %ms_webout(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt,missing=&missing';
put ' ,showmeta=&showmeta';
put ' ,showmeta=&showmeta,maxobs=&maxobs';
put ' )';
put '%mend;';
run;
Expand Down Expand Up @@ -24491,9 +24493,11 @@ data _null_;
put '%global __program _program;';
put '%let _program=%sysfunc(coalescec(&__program,&_program));';
put ' ';
put '%macro webout(action,ds,dslabel=,fmt=,missing=NULL,showmeta=NO);';
put '%macro webout(action,ds,dslabel=,fmt=,missing=NULL,showmeta=NO';
put ' ,maxobs=MAX';
put ');';
put ' %mv_webout(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt,missing=&missing';
put ' ,showmeta=&showmeta';
put ' ,showmeta=&showmeta,maxobs=&maxobs';
put ' )';
put '%mend;';
run;
Expand Down
10 changes: 5 additions & 5 deletions base/mp_applyformats.sas
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ data &outds;
if libref(lib) ne 0 then do;
msg=catx(' ','libref',lib,'is not assigned!');
%if &errds=0 %then %do;
putlog "%str(ERR)OR: " msg;
putlog 'ERR' +(-1) "OR: " msg;
%end;
output;
return;
end;
if exist(cats(lib,'.',ds)) ne 1 then do;
msg=catx(' ','libds',lib,'.',ds,'does not exist!');
%if &errds=0 %then %do;
putlog "%str(ERR)OR: " msg;
putlog 'ERR' +(-1) "OR: " msg;
%end;
output;
return;
Expand All @@ -111,7 +111,7 @@ data &outds;
if is_fmt=0 then do;
msg=catx(' ','format',fmt,'on libds',lib,'.',ds,'.',var,'is not valid!');
%if &errds=0 %then %do;
putlog "%str(ERR)OR: " msg;
putlog 'ERR' +(-1) "OR: " msg;
%end;
output;
return;
Expand All @@ -123,15 +123,15 @@ data &outds;
if dsid=0 then do;
msg=catx(' ','libds',lib,'.',ds,' could not be opened!');
%if &errds=0 %then %do;
putlog "%str(ERR)OR: " msg;
putlog 'ERR' +(-1) "OR: " msg;
%end;
output;
return;
end;
if varnum(dsid,var)<1 then do;
msg=catx(' ','Variable',lib,'.',ds,'.',var,' was not found!');
%if &errds=0 %then %do;
putlog "%str(ERR)OR: " msg;
putlog 'ERR' +(-1) "OR: " msg;
%end;
output;
end;
Expand Down
2 changes: 1 addition & 1 deletion base/mp_copyfolder.sas
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
rc2=filename(fref2,filepath2,'disk','recfm=n');
if fcopy(fref1,fref2) ne 0 then do;
msg=sysmsg();
putlog "%str(ERR)OR: Unable to copy " filepath " to " filepath2;
putlog 'ERR' +(-1) "OR: Unable to copy " filepath " to " filepath2;
putlog msg=;
end;
end;
Expand Down
4 changes: 2 additions & 2 deletions base/mp_validatecol.sas
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
retain &tempcol;
&tempcol=prxparse('/^[_a-z]\w{0,7}\.[_a-z]\w{0,31}$/i');
if missing(&tempcol) then do;
putlog "%str(ERR)OR: Invalid expression for LIBDS";
putlog 'ERR' +(-1) "OR: Invalid expression for LIBDS";
stop;
end;
drop &tempcol;
Expand All @@ -85,7 +85,7 @@
retain &tempcol;
&tempcol=prxparse('/^[_a-z\$]\w{0,31}\.[0-9]*$/i');
if missing(&tempcol) then do;
putlog "%str(ERR)OR: Invalid expression for FORMAT";
putlog 'ERR' +(-1) "OR: Invalid expression for FORMAT";
stop;
end;
drop &tempcol;
Expand Down
10 changes: 5 additions & 5 deletions meta/mm_createfolder.sas
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ data _null_;

* name must not be blank;
if ( folderPath = '' ) then do;
put "%str(ERR)OR: &sysmacroname PATH parameter value must be non-blank";
put 'ERR' +(-1) "OR: &sysmacroname PATH parameter value must be non-blank";
end;

* must have a starting slash ;
if ( substr(folderPath,1,1) ne '/' ) then do;
put "%str(ERR)OR: &sysmacroname PATH param value must have starting slash";
put 'ERR' +(-1) "OR: &sysmacroname PATH param value must have starting slash";
stop;
end;

Expand All @@ -69,14 +69,14 @@ data _null_;

* do not create a root (one level) folder ;
if countc(folderPath,'/')=1 then do;
put "%str(ERR)OR: &sysmacroname will not create a new ROOT folder";
put 'ERR' +(-1) "OR: &sysmacroname will not create a new ROOT folder";
stop;
end;

* check that root folder exists ;
root=cats('/',scan(folderpath,1,'/'),"(Folder)");
if metadata_pathobj('',root,"",objType,parentId)<1 then do;
put "%str(ERR)OR: " root " does not exist!";
put 'ERR' +(-1) "OR: " root " does not exist!";
stop;
end;

Expand Down Expand Up @@ -141,7 +141,7 @@ run;
putlog "SUCCCESS! &path created.";
end;
else do;
putlog "%str(ERR)OR: unsuccessful attempt to create &path";
putlog 'ERR' +(-1) "OR: unsuccessful attempt to create &path";
call symputx('syscc',8);
end;
run;
Expand Down
2 changes: 1 addition & 1 deletion meta/mm_getstpinfo.sas
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ data &outds;
rc5=metadata_getattr(tsuri,"Name",servercontext);
end;
else do;
put "%str(ERR)OR: could not find " path;
put 'ERR' +(-1) "OR: could not find " path;
put (_all_)(=);
end;
&md.put (_all_)(=);
Expand Down
6 changes: 4 additions & 2 deletions server/ms_createwebservice.sas
Original file line number Diff line number Diff line change
Expand Up @@ -652,9 +652,11 @@ data _null_;
put ' ';
put '%mend mfs_httpheader; ';
/* WEBOUT END */
put '%macro webout(action,ds,dslabel=,fmt=,missing=NULL,showmeta=NO);';
put '%macro webout(action,ds,dslabel=,fmt=,missing=NULL,showmeta=NO';
put ' ,maxobs=MAX';
put ');';
put ' %ms_webout(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt,missing=&missing';
put ' ,showmeta=&showmeta';
put ' ,showmeta=&showmeta,maxobs=&maxobs';
put ' )';
put '%mend;';
run;
Expand Down
6 changes: 4 additions & 2 deletions viya/mv_createwebservice.sas
Original file line number Diff line number Diff line change
Expand Up @@ -814,9 +814,11 @@ data _null_;
put '%global __program _program;';
put '%let _program=%sysfunc(coalescec(&__program,&_program));';
put ' ';
put '%macro webout(action,ds,dslabel=,fmt=,missing=NULL,showmeta=NO);';
put '%macro webout(action,ds,dslabel=,fmt=,missing=NULL,showmeta=NO';
put ' ,maxobs=MAX';
put ');';
put ' %mv_webout(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt,missing=&missing';
put ' ,showmeta=&showmeta';
put ' ,showmeta=&showmeta,maxobs=&maxobs';
put ' )';
put '%mend;';
run;
Expand Down

0 comments on commit 91a2d90

Please sign in to comment.