1
0
mirror of https://github.com/sasjs/core.git synced 2025-12-25 12:11:19 +00:00

Compare commits

...

7 Commits

Author SHA1 Message Date
Allan Bowe
825c97c49c fix: switch postinstall to prepare 2021-06-30 19:50:20 +03:00
Allan Bowe
f301899269 Merge pull request #51 from sasjs/issue50
fix: setting syscc to zero to prevent error state in response.  Close…
2021-06-29 00:09:42 +03:00
Allan Bowe
fc81f62d2f fix: setting syscc to zero to prevent error state in response. Closes #50 2021-06-28 23:52:12 +03:00
Allan Bowe
93aea5ed02 Merge pull request #49 from sasjs/logfix
Context fixes on mv_jobflow and mp_testservice
2021-06-27 00:35:24 +03:00
Allan Bowe
55d4c7238a fix: updating mp_testservice.sas and mv_jobflow to use the provided context. Also updating mv_getjobresult to fetch byte by byte (as some inputs are very wide). 2021-06-27 00:22:53 +03:00
Allan Bowe
cd75bf263a fix: removing redundant parameter from mv_getjoblog 2021-06-26 21:11:26 +03:00
Allan Bowe
929a1a9974 chore: updating docs 2021-06-24 00:39:09 +03:00
8 changed files with 72 additions and 38 deletions

53
all.sas
View File

@@ -1678,6 +1678,7 @@ Usage:
sysuserid=symget('sysuserid');
iftrue=symget('iftrue');
put (_all_)(/=);
call symputx('syscc',0);
abort cancel nolist;
run;
%end;
@@ -2177,6 +2178,7 @@ Usage:
@details Creates a new version of a file either encoded or decoded using
Base64. Inspired by this post by Michael Dixon:
https://support.selerity.com.au/hc/en-us/articles/223345708-Tip-SAS-and-Base64
Usage:
filename tmp temp;
@@ -2200,16 +2202,18 @@ Usage:
put _infile_;
run;
@param inref= Fileref of the input file (should exist)
@param outref= Output filref. If it does not exist, it is created.
@param action= (ENCODE) The action to take. Valid values:
@li ENCODE Convert the file to base64 format
@li DECODE Decode the file from base64 format
@param [in] inref= Fileref of the input file (should exist)
@param [out] outref= Output fileref. If it does not exist, it is created.
@param [in] action= (ENCODE) The action to take. Valid values:
@li ENCODE - Convert the file to base64 format
@li DECODE - Decode the file from base64 format
@version 9.2
@author Allan Bowe, source: https://github.com/sasjs/core
<h4> SAS Macros </h4>
@li mp_abort.sas
@version 9.2
**/
@@ -6360,8 +6364,11 @@ libname &lib clear;
|mustbevalidname|can be anything, oops, %abort!!|
@param [in] debug= (log) Provide the _debug value
@param [in] viyaresult=(WEBOUT_JSON) The Viya result type to return. For
@param [in] mdebug= (0) Set to 1 to provide macro debugging
@param [in] viyaresult= (WEBOUT_JSON) The Viya result type to return. For
more info, see mv_getjobresult.sas
@param [in] viyacontext= (SAS Job Execution compute context) The Viya compute
context on which to run the service
@param [out] outlib= (0) Output libref to contain the final tables. Set to
0 if the service output is not in JSON format.
@param [out] outref= (0) Output fileref to create, to contain the full _webout
@@ -6385,17 +6392,18 @@ libname &lib clear;
inputfiles=0,
inputparams=0,
debug=log,
mdebug=0,
outlib=0,
outref=0,
viyaresult=WEBOUT_JSON
viyaresult=WEBOUT_JSON,
viyacontext=SAS Job Execution compute context
)/*/STORE SOURCE*/;
%local mdebug;
%if &debug ne 0 %then %do;
%let mdebug=1;
%local dbg;
%if &mdebug=1 %then %do;
%put &sysmacroname entry vars:;
%put _local_;
%end;
%else %let mdebug=0;
%else %let dbg=*;
/* sanitise inputparams */
%local pcnt;
@@ -6550,6 +6558,7 @@ libname &lib clear;
data &ds1;
retain _program "&program";
retain _contextname "&viyacontext";
set &ds1;
putlog "&sysmacroname inputparams:";
putlog (_all_)(=);
@@ -15567,7 +15576,7 @@ run;
@param [in] access_token_var= The global macro variable to contain the access
token
@param [in] mdebug= set to 1 to enable DEBUG messages
@param [in] mdebug= (0) Set to 1 to enable DEBUG messages
@param [in] grant_type= valid values:
@li password
@li authorization_code
@@ -15592,7 +15601,6 @@ run;
**/
%macro mv_getjoblog(uri=0,outref=0
,contextName=SAS Job Execution compute context
,access_token_var=ACCESS_TOKEN
,grant_type=sas_services
,mdebug=0
@@ -15913,7 +15921,6 @@ run;
**/
%macro mv_getjobresult(uri=0
,contextName=SAS Job Execution compute context
,access_token_var=ACCESS_TOKEN
,grant_type=sas_services
,mdebug=0
@@ -16027,10 +16034,11 @@ proc http method='GET' out=&fname2 &oauth_bearer
;
run;
%if &mdebug=1 %then %do;
/* send one char at a time as the json can be very wide */
data _null_;
infile &fname2 lrecl=32767;
input;
putlog _infile_;
infile &fname2 recfm=n;
input char $char1. ;
putlog char $char1. @;
run;
%end;
@@ -16787,6 +16795,11 @@ run;
%if &mdebug=1 %then %do;
%put &sysmacroname entry vars:;
%put _local_;
%put inds vars:;
data _null_;
set &inds;
putlog (_all_)(=);
run;
%end;
%else %let dbg=*;
@@ -16831,6 +16844,7 @@ run;
retain FLOW_ID 0;
%end;
set &inds;
&dbg. putlog (_all_)(=);
run;
%end;
@@ -16895,6 +16909,8 @@ data;run;%let jdswaitfor=&syslast;
call symputx(cats('job',_n_),_program,'l');
call symputx(cats('context',_n_),_contextName,'l');
call symputx('jcnt',_n_,'l');
&dbg. if _n_= 1 then putlog "Loop &fid";
&dbg. putlog (_all_)(=);
run;
%put exporting job variables in json format;
%do jid=1 %to &jcnt;
@@ -16956,6 +16972,7 @@ data;run;%let jdswaitfor=&syslast;
,name=&jobname
,paramstring=%superq(jparams&jid)
,outds=&jdsapp
,contextname=&&context&jid
)
data &jdsapp;
format jobparams $32767.;

View File

@@ -165,6 +165,7 @@
sysuserid=symget('sysuserid');
iftrue=symget('iftrue');
put (_all_)(/=);
call symputx('syscc',0);
abort cancel nolist;
run;
%end;

View File

@@ -4,6 +4,7 @@
@details Creates a new version of a file either encoded or decoded using
Base64. Inspired by this post by Michael Dixon:
https://support.selerity.com.au/hc/en-us/articles/223345708-Tip-SAS-and-Base64
Usage:
filename tmp temp;
@@ -27,16 +28,18 @@
put _infile_;
run;
@param inref= Fileref of the input file (should exist)
@param outref= Output filref. If it does not exist, it is created.
@param action= (ENCODE) The action to take. Valid values:
@li ENCODE Convert the file to base64 format
@li DECODE Decode the file from base64 format
@param [in] inref= Fileref of the input file (should exist)
@param [out] outref= Output fileref. If it does not exist, it is created.
@param [in] action= (ENCODE) The action to take. Valid values:
@li ENCODE - Convert the file to base64 format
@li DECODE - Decode the file from base64 format
@version 9.2
@author Allan Bowe, source: https://github.com/sasjs/core
<h4> SAS Macros </h4>
@li mp_abort.sas
@version 9.2
**/

View File

@@ -22,8 +22,11 @@
|mustbevalidname|can be anything, oops, %abort!!|
@param [in] debug= (log) Provide the _debug value
@param [in] viyaresult=(WEBOUT_JSON) The Viya result type to return. For
@param [in] mdebug= (0) Set to 1 to provide macro debugging
@param [in] viyaresult= (WEBOUT_JSON) The Viya result type to return. For
more info, see mv_getjobresult.sas
@param [in] viyacontext= (SAS Job Execution compute context) The Viya compute
context on which to run the service
@param [out] outlib= (0) Output libref to contain the final tables. Set to
0 if the service output is not in JSON format.
@param [out] outref= (0) Output fileref to create, to contain the full _webout
@@ -47,17 +50,18 @@
inputfiles=0,
inputparams=0,
debug=log,
mdebug=0,
outlib=0,
outref=0,
viyaresult=WEBOUT_JSON
viyaresult=WEBOUT_JSON,
viyacontext=SAS Job Execution compute context
)/*/STORE SOURCE*/;
%local mdebug;
%if &debug ne 0 %then %do;
%let mdebug=1;
%local dbg;
%if &mdebug=1 %then %do;
%put &sysmacroname entry vars:;
%put _local_;
%end;
%else %let mdebug=0;
%else %let dbg=*;
/* sanitise inputparams */
%local pcnt;
@@ -212,6 +216,7 @@
data &ds1;
retain _program "&program";
retain _contextname "&viyacontext";
set &ds1;
putlog "&sysmacroname inputparams:";
putlog (_all_)(=);

View File

@@ -30,9 +30,9 @@
"docs": "sasjs doc && ./sasjs/utils/build.sh",
"test": "sasjs test -t viya",
"lint": "sasjs lint",
"postinstall": "[ -d .git ] && git config core.hooksPath ./.git-hooks || true"
"prepare": "[ -d .git ] && git config core.hooksPath ./.git-hooks || true"
},
"devDependencies": {
"@sasjs/cli": "^2.27.0"
"@sasjs/cli": "2.27.0"
}
}

View File

@@ -66,7 +66,7 @@
@param [in] access_token_var= The global macro variable to contain the access
token
@param [in] mdebug= set to 1 to enable DEBUG messages
@param [in] mdebug= (0) Set to 1 to enable DEBUG messages
@param [in] grant_type= valid values:
@li password
@li authorization_code
@@ -91,7 +91,6 @@
**/
%macro mv_getjoblog(uri=0,outref=0
,contextName=SAS Job Execution compute context
,access_token_var=ACCESS_TOKEN
,grant_type=sas_services
,mdebug=0

View File

@@ -90,7 +90,6 @@
**/
%macro mv_getjobresult(uri=0
,contextName=SAS Job Execution compute context
,access_token_var=ACCESS_TOKEN
,grant_type=sas_services
,mdebug=0
@@ -204,10 +203,11 @@ proc http method='GET' out=&fname2 &oauth_bearer
;
run;
%if &mdebug=1 %then %do;
/* send one char at a time as the json can be very wide */
data _null_;
infile &fname2 lrecl=32767;
input;
putlog _infile_;
infile &fname2 recfm=n;
input char $char1. ;
putlog char $char1. @;
run;
%end;

View File

@@ -140,6 +140,11 @@
%if &mdebug=1 %then %do;
%put &sysmacroname entry vars:;
%put _local_;
%put inds vars:;
data _null_;
set &inds;
putlog (_all_)(=);
run;
%end;
%else %let dbg=*;
@@ -184,6 +189,7 @@
retain FLOW_ID 0;
%end;
set &inds;
&dbg. putlog (_all_)(=);
run;
%end;
@@ -248,6 +254,8 @@ data;run;%let jdswaitfor=&syslast;
call symputx(cats('job',_n_),_program,'l');
call symputx(cats('context',_n_),_contextName,'l');
call symputx('jcnt',_n_,'l');
&dbg. if _n_= 1 then putlog "Loop &fid";
&dbg. putlog (_all_)(=);
run;
%put exporting job variables in json format;
%do jid=1 %to &jcnt;
@@ -309,6 +317,7 @@ data;run;%let jdswaitfor=&syslast;
,name=&jobname
,paramstring=%superq(jparams&jid)
,outds=&jdsapp
,contextname=&&context&jid
)
data &jdsapp;
format jobparams $32767.;