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

fix: ensuring unique filerefs in mm_updatestpsourcecode macro. Marking previous placeholders as deprecated for future release.

This commit is contained in:
2021-03-07 18:46:32 +01:00
parent fb5f1c820a
commit ff45c5a8b8
3 changed files with 50 additions and 36 deletions

43
all.sas
View File

@@ -10301,16 +10301,15 @@ run;
%end;
%mend;/**
@file mm_updatestpservertype.sas
@file
@brief Updates a type 2 stored process to run on STP or WKS context
@details Only works on Type 2 (9.3 compatible) STPs
Usage:
%mm_updatestpservertype(target=/some/meta/path/myStoredProcess
,type=WKS)
%mm_updatestpservertype(target=/some/meta/path/myStoredProcess
,type=WKS)
<h4> SAS Macros </h4>
@param target= full path to the STP being deleted
@param type= Either WKS or STP depending on whether Workspace or Stored Process
@@ -10375,31 +10374,40 @@ run;
Usage:
%mm_updatestpsourcecode(stp=/my/metadata/path/mystpname
,stpcode="/file/system/source.sas")
%mm_updatestpsourcecode(stp=/my/metadata/path/mystpname
,stpcode="/file/system/source.sas")
@param stp= the BIP Tree folder path plus Stored Process Name
@param stpcode= the source file (or fileref) containing the SAS code to load
@param [in] stp= the BIP Tree folder path plus Stored Process Name
@param [in] stpcode= the source file (or fileref) containing the SAS code to load
into the stp. For multiple files, they should simply be concatenated first.
@param minify= set to YES in order to strip comments, blank lines, and CRLFs.
@param [in] minify= set to YES in order to strip comments, blank lines, and CRLFs.
@param frefin= change default inref if it clashes with an existing one
@param frefout= change default outref if it clashes with an existing one
@param frefin= deprecated - a unique fileref is now always used
@param frefout= deprecated - a unique fileref is now always used
@param mDebug= set to 1 to show debug messages in the log
@version 9.3
@author Allan Bowe
<h4> SAS Macros </h4>
@li mf_getuniquefileref.sas
**/
%macro mm_updatestpsourcecode(stp=
,stpcode=
,minify=NO
,mdebug=0
/* deprecated */
,frefin=inmeta
,frefout=outmeta
,mdebug=0
);
%if &frefin ne inmeta or &frefout ne outmeta %then %do;
%put %str(WARN)ING: the frefin and frefout parameters will be deprecated in
an upcoming release.;
%end;
/* first, check if STP exists */
%local tsuri;
%let tsuri=stopifempty ;
@@ -10437,7 +10445,9 @@ run;
%return;
%end;
filename &frefin temp lrecl=32767;
%local frefin frefout;
%let frefin=%mf_getuniquefileref();
%let frefout=%mf_getuniquefileref();
/* write header XML */
data _null_;
@@ -10450,7 +10460,7 @@ run;
/* write contents */
%if %length(&stpcode)>2 %then %do;
data _null_;
file &frefin mod;
file &frefin lrecl=32767 mod;
infile &stpcode lrecl=32767;
length outstr $32767;
input outstr ;
@@ -10479,9 +10489,6 @@ data _null_;
</UpdateMetadata>";
run;
filename &frefout temp;
proc metadata in= &frefin out=&frefout;
run;

View File

@@ -1,14 +1,13 @@
/**
@file mm_updatestpservertype.sas
@file
@brief Updates a type 2 stored process to run on STP or WKS context
@details Only works on Type 2 (9.3 compatible) STPs
Usage:
%mm_updatestpservertype(target=/some/meta/path/myStoredProcess
,type=WKS)
%mm_updatestpservertype(target=/some/meta/path/myStoredProcess
,type=WKS)
<h4> SAS Macros </h4>
@param target= full path to the STP being deleted
@param type= Either WKS or STP depending on whether Workspace or Stored Process

View File

@@ -6,31 +6,40 @@
Usage:
%mm_updatestpsourcecode(stp=/my/metadata/path/mystpname
,stpcode="/file/system/source.sas")
%mm_updatestpsourcecode(stp=/my/metadata/path/mystpname
,stpcode="/file/system/source.sas")
@param stp= the BIP Tree folder path plus Stored Process Name
@param stpcode= the source file (or fileref) containing the SAS code to load
@param [in] stp= the BIP Tree folder path plus Stored Process Name
@param [in] stpcode= the source file (or fileref) containing the SAS code to load
into the stp. For multiple files, they should simply be concatenated first.
@param minify= set to YES in order to strip comments, blank lines, and CRLFs.
@param [in] minify= set to YES in order to strip comments, blank lines, and CRLFs.
@param frefin= change default inref if it clashes with an existing one
@param frefout= change default outref if it clashes with an existing one
@param frefin= deprecated - a unique fileref is now always used
@param frefout= deprecated - a unique fileref is now always used
@param mDebug= set to 1 to show debug messages in the log
@version 9.3
@author Allan Bowe
<h4> SAS Macros </h4>
@li mf_getuniquefileref.sas
**/
%macro mm_updatestpsourcecode(stp=
,stpcode=
,minify=NO
,mdebug=0
/* deprecated */
,frefin=inmeta
,frefout=outmeta
,mdebug=0
);
%if &frefin ne inmeta or &frefout ne outmeta %then %do;
%put %str(WARN)ING: the frefin and frefout parameters will be deprecated in
an upcoming release.;
%end;
/* first, check if STP exists */
%local tsuri;
%let tsuri=stopifempty ;
@@ -68,7 +77,9 @@ run;
%return;
%end;
filename &frefin temp lrecl=32767;
%local frefin frefout;
%let frefin=%mf_getuniquefileref();
%let frefout=%mf_getuniquefileref();
/* write header XML */
data _null_;
@@ -81,7 +92,7 @@ run;
/* write contents */
%if %length(&stpcode)>2 %then %do;
data _null_;
file &frefin mod;
file &frefin lrecl=32767 mod;
infile &stpcode lrecl=32767;
length outstr $32767;
input outstr ;
@@ -110,9 +121,6 @@ data _null_;
</UpdateMetadata>";
run;
filename &frefout temp;
proc metadata in= &frefin out=&frefout;
run;