mirror of
https://github.com/sasjs/core.git
synced 2026-01-07 09:30:06 +00:00
Merge pull request #187 from sasjs/periodproblem
fix: mp_replace and mv_getjobcode were not ingesting periods correctly
This commit is contained in:
34
all.sas
34
all.sas
@@ -9693,7 +9693,7 @@ filename &inref &infile lrecl=1 recfm=n;
|
|||||||
|
|
||||||
data &ds1;
|
data &ds1;
|
||||||
infile &inref;
|
infile &inref;
|
||||||
input sourcechar $ 1. @@;
|
input sourcechar $char1. @@;
|
||||||
format sourcechar hex2.;
|
format sourcechar hex2.;
|
||||||
run;
|
run;
|
||||||
|
|
||||||
@@ -21527,7 +21527,7 @@ filename &fname1 clear;
|
|||||||
,grant_type=sas_services
|
,grant_type=sas_services
|
||||||
,outds=work.viyagroups
|
,outds=work.viyagroups
|
||||||
);
|
);
|
||||||
%local oauth_bearer;
|
%local oauth_bearer base_uri fname1 libref1;
|
||||||
%if &grant_type=detect %then %do;
|
%if &grant_type=detect %then %do;
|
||||||
%if %symexist(&access_token_var) %then %let grant_type=authorization_code;
|
%if %symexist(&access_token_var) %then %let grant_type=authorization_code;
|
||||||
%else %let grant_type=sas_services;
|
%else %let grant_type=sas_services;
|
||||||
@@ -21545,11 +21545,10 @@ filename &fname1 clear;
|
|||||||
)
|
)
|
||||||
|
|
||||||
options noquotelenmax;
|
options noquotelenmax;
|
||||||
%local base_uri; /* location of rest apis */
|
/* location of rest apis */
|
||||||
%let base_uri=%mf_getplatform(VIYARESTAPI);
|
%let base_uri=%mf_getplatform(VIYARESTAPI);
|
||||||
|
|
||||||
/* fetching folder details for provided path */
|
/* fetching folder details for provided path */
|
||||||
%local fname1;
|
|
||||||
%let fname1=%mf_getuniquefileref();
|
%let fname1=%mf_getuniquefileref();
|
||||||
%let libref1=%mf_getuniquelibref();
|
%let libref1=%mf_getuniquelibref();
|
||||||
|
|
||||||
@@ -21573,12 +21572,12 @@ data &outds;
|
|||||||
run;
|
run;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* clear refs */
|
/* clear refs */
|
||||||
filename &fname1 clear;
|
filename &fname1 clear;
|
||||||
libname &libref1 clear;
|
libname &libref1 clear;
|
||||||
|
|
||||||
%mend mv_getgroups;/**
|
%mend mv_getgroups;
|
||||||
|
/**
|
||||||
@file
|
@file
|
||||||
@brief Extract the source code from a SAS Viya Job
|
@brief Extract the source code from a SAS Viya Job
|
||||||
@details Extracts the SAS code from a Job into a fileref or physical file.
|
@details Extracts the SAS code from a Job into a fileref or physical file.
|
||||||
@@ -21625,7 +21624,7 @@ libname &libref1 clear;
|
|||||||
);
|
);
|
||||||
%local dbg bufsize varcnt fname1 fname2 errmsg;
|
%local dbg bufsize varcnt fname1 fname2 errmsg;
|
||||||
%if &mdebug=1 %then %do;
|
%if &mdebug=1 %then %do;
|
||||||
%put &sysmacroname entry vars:;
|
%put &sysmacroname local entry vars:;
|
||||||
%put _local_;
|
%put _local_;
|
||||||
%end;
|
%end;
|
||||||
%else %let dbg=*;
|
%else %let dbg=*;
|
||||||
@@ -21692,14 +21691,21 @@ proc http method='GET' out=&fname1 &oauth_bearer
|
|||||||
%end;
|
%end;
|
||||||
;
|
;
|
||||||
run;
|
run;
|
||||||
%if &SYS_PROCHTTP_STATUS_CODE ne 200 and &SYS_PROCHTTP_STATUS_CODE ne 201 %then
|
|
||||||
%do;
|
%if &mdebug=1 %then %do;
|
||||||
data _null_;infile &fname1;input;putlog _infile_;run;
|
data _null_;
|
||||||
%mp_abort(mac=&sysmacroname
|
infile &fname1;
|
||||||
,msg=%str(&SYS_PROCHTTP_STATUS_CODE &SYS_PROCHTTP_STATUS_PHRASE)
|
input;
|
||||||
)
|
putlog _infile_;
|
||||||
|
run;
|
||||||
%end;
|
%end;
|
||||||
|
|
||||||
|
%mp_abort(
|
||||||
|
iftrue=(&SYS_PROCHTTP_STATUS_CODE ne 200 and &SYS_PROCHTTP_STATUS_CODE ne 201)
|
||||||
|
,mac=&sysmacroname
|
||||||
|
,msg=%str(&SYS_PROCHTTP_STATUS_CODE &SYS_PROCHTTP_STATUS_PHRASE)
|
||||||
|
)
|
||||||
|
|
||||||
%let fname2=%mf_getuniquefileref();
|
%let fname2=%mf_getuniquefileref();
|
||||||
filename &fname2 temp ;
|
filename &fname2 temp ;
|
||||||
|
|
||||||
@@ -21708,7 +21714,7 @@ filename &fname2 temp ;
|
|||||||
data _null_;
|
data _null_;
|
||||||
file &fname2 recfm=n;
|
file &fname2 recfm=n;
|
||||||
infile &fname1 lrecl=1 recfm=n;
|
infile &fname1 lrecl=1 recfm=n;
|
||||||
input sourcechar $ 1. @@;
|
input sourcechar $char1. @@;
|
||||||
format sourcechar hex2.;
|
format sourcechar hex2.;
|
||||||
retain startwrite 0;
|
retain startwrite 0;
|
||||||
if startwrite=0 and sourcechar='"' then do;
|
if startwrite=0 and sourcechar='"' then do;
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ filename &inref &infile lrecl=1 recfm=n;
|
|||||||
|
|
||||||
data &ds1;
|
data &ds1;
|
||||||
infile &inref;
|
infile &inref;
|
||||||
input sourcechar $ 1. @@;
|
input sourcechar $char1. @@;
|
||||||
format sourcechar hex2.;
|
format sourcechar hex2.;
|
||||||
run;
|
run;
|
||||||
|
|
||||||
|
|||||||
@@ -63,3 +63,33 @@ run;
|
|||||||
desc=Checking second replace 3rd row,
|
desc=Checking second replace 3rd row,
|
||||||
outds=work.test_results
|
outds=work.test_results
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
%let test3="&sasjswork/file3.txt";
|
||||||
|
%let str=%str(replace.string.with.dots );
|
||||||
|
%let rep=%str( more.dots);
|
||||||
|
data _null_;
|
||||||
|
file &test3;
|
||||||
|
put 'blahblah';
|
||||||
|
put "blahblah&str.blah&str. replace &str.X";
|
||||||
|
put "blahbreplacewith&str.spacesahblah";
|
||||||
|
run;
|
||||||
|
%mp_replace(&test3, findvar=str, replacevar=rep)
|
||||||
|
|
||||||
|
data _null_;
|
||||||
|
infile &test3;
|
||||||
|
input;
|
||||||
|
if _n_=2 then call symputx('test3resulta',_infile_);
|
||||||
|
if _n_=3 then call symputx('test3resultb',_infile_);
|
||||||
|
run;
|
||||||
|
|
||||||
|
%mp_assert(
|
||||||
|
iftrue=("&test3resulta" = "blahblah&rep.blah&rep. replace &rep.X"),
|
||||||
|
desc=Checking third replace 2nd row (dots),
|
||||||
|
outds=work.test_results
|
||||||
|
)
|
||||||
|
%mp_assert(
|
||||||
|
iftrue=("&test3resultb" = "blahbreplacewith&rep.spacesahblah"),
|
||||||
|
desc=Checking third replace 3rd row (dots),
|
||||||
|
outds=work.test_results
|
||||||
|
)
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
,grant_type=sas_services
|
,grant_type=sas_services
|
||||||
,outds=work.viyagroups
|
,outds=work.viyagroups
|
||||||
);
|
);
|
||||||
%local oauth_bearer;
|
%local oauth_bearer base_uri fname1 libref1;
|
||||||
%if &grant_type=detect %then %do;
|
%if &grant_type=detect %then %do;
|
||||||
%if %symexist(&access_token_var) %then %let grant_type=authorization_code;
|
%if %symexist(&access_token_var) %then %let grant_type=authorization_code;
|
||||||
%else %let grant_type=sas_services;
|
%else %let grant_type=sas_services;
|
||||||
@@ -50,11 +50,10 @@
|
|||||||
)
|
)
|
||||||
|
|
||||||
options noquotelenmax;
|
options noquotelenmax;
|
||||||
%local base_uri; /* location of rest apis */
|
/* location of rest apis */
|
||||||
%let base_uri=%mf_getplatform(VIYARESTAPI);
|
%let base_uri=%mf_getplatform(VIYARESTAPI);
|
||||||
|
|
||||||
/* fetching folder details for provided path */
|
/* fetching folder details for provided path */
|
||||||
%local fname1;
|
|
||||||
%let fname1=%mf_getuniquefileref();
|
%let fname1=%mf_getuniquefileref();
|
||||||
%let libref1=%mf_getuniquelibref();
|
%let libref1=%mf_getuniquelibref();
|
||||||
|
|
||||||
@@ -78,7 +77,6 @@ data &outds;
|
|||||||
run;
|
run;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* clear refs */
|
/* clear refs */
|
||||||
filename &fname1 clear;
|
filename &fname1 clear;
|
||||||
libname &libref1 clear;
|
libname &libref1 clear;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
);
|
);
|
||||||
%local dbg bufsize varcnt fname1 fname2 errmsg;
|
%local dbg bufsize varcnt fname1 fname2 errmsg;
|
||||||
%if &mdebug=1 %then %do;
|
%if &mdebug=1 %then %do;
|
||||||
%put &sysmacroname entry vars:;
|
%put &sysmacroname local entry vars:;
|
||||||
%put _local_;
|
%put _local_;
|
||||||
%end;
|
%end;
|
||||||
%else %let dbg=*;
|
%else %let dbg=*;
|
||||||
@@ -112,14 +112,21 @@ proc http method='GET' out=&fname1 &oauth_bearer
|
|||||||
%end;
|
%end;
|
||||||
;
|
;
|
||||||
run;
|
run;
|
||||||
%if &SYS_PROCHTTP_STATUS_CODE ne 200 and &SYS_PROCHTTP_STATUS_CODE ne 201 %then
|
|
||||||
%do;
|
%if &mdebug=1 %then %do;
|
||||||
data _null_;infile &fname1;input;putlog _infile_;run;
|
data _null_;
|
||||||
%mp_abort(mac=&sysmacroname
|
infile &fname1;
|
||||||
,msg=%str(&SYS_PROCHTTP_STATUS_CODE &SYS_PROCHTTP_STATUS_PHRASE)
|
input;
|
||||||
)
|
putlog _infile_;
|
||||||
|
run;
|
||||||
%end;
|
%end;
|
||||||
|
|
||||||
|
%mp_abort(
|
||||||
|
iftrue=(&SYS_PROCHTTP_STATUS_CODE ne 200 and &SYS_PROCHTTP_STATUS_CODE ne 201)
|
||||||
|
,mac=&sysmacroname
|
||||||
|
,msg=%str(&SYS_PROCHTTP_STATUS_CODE &SYS_PROCHTTP_STATUS_PHRASE)
|
||||||
|
)
|
||||||
|
|
||||||
%let fname2=%mf_getuniquefileref();
|
%let fname2=%mf_getuniquefileref();
|
||||||
filename &fname2 temp ;
|
filename &fname2 temp ;
|
||||||
|
|
||||||
@@ -128,7 +135,7 @@ filename &fname2 temp ;
|
|||||||
data _null_;
|
data _null_;
|
||||||
file &fname2 recfm=n;
|
file &fname2 recfm=n;
|
||||||
infile &fname1 lrecl=1 recfm=n;
|
infile &fname1 lrecl=1 recfm=n;
|
||||||
input sourcechar $ 1. @@;
|
input sourcechar $char1. @@;
|
||||||
format sourcechar hex2.;
|
format sourcechar hex2.;
|
||||||
retain startwrite 0;
|
retain startwrite 0;
|
||||||
if startwrite=0 and sourcechar='"' then do;
|
if startwrite=0 and sourcechar='"' then do;
|
||||||
|
|||||||
Reference in New Issue
Block a user