@sasjs/core 4.66.3 → 4.67.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -595,13 +595,13 @@ data _null_;
|
|
|
595
595
|
put '); ';
|
|
596
596
|
put '%global _webin_file_count _webin_fileuri _debug _omittextlog _webin_name ';
|
|
597
597
|
put ' sasjs_tables SYS_JES_JOB_URI _EXECUTIONTASKS; ';
|
|
598
|
-
put '%if %index("&_debug",log) %then %let _debug=
|
|
598
|
+
put '%if %index("&_debug",log) %then %let _debug=128; ';
|
|
599
599
|
put ' ';
|
|
600
600
|
put '%local i tempds table; ';
|
|
601
601
|
put '%let action=%upcase(&action); ';
|
|
602
602
|
put ' ';
|
|
603
603
|
put '%if &action=FETCH %then %do; ';
|
|
604
|
-
put ' %if %upcase(&_omittextlog)=FALSE or %str(&_debug) ge
|
|
604
|
+
put ' %if %upcase(&_omittextlog)=FALSE or %str(&_debug) ge 128 %then %do; ';
|
|
605
605
|
put ' options mprint notes mprintnest; ';
|
|
606
606
|
put ' %end; ';
|
|
607
607
|
put ' ';
|
|
@@ -664,7 +664,7 @@ data _null_;
|
|
|
664
664
|
put ' infile indata termstr=crlf lrecl=32767; ';
|
|
665
665
|
put ' input; ';
|
|
666
666
|
put ' if _n_=1 then call symputx(''input_statement'',_infile_); ';
|
|
667
|
-
put ' %if %str(&_debug) ge
|
|
667
|
+
put ' %if %str(&_debug) ge 128 %then %do; ';
|
|
668
668
|
put ' if _n_<20 then putlog _infile_; ';
|
|
669
669
|
put ' else stop; ';
|
|
670
670
|
put ' %end; ';
|
|
@@ -697,7 +697,7 @@ data _null_;
|
|
|
697
697
|
put ' ';
|
|
698
698
|
put ' /* setup json */ ';
|
|
699
699
|
put ' data _null_;file &fref; ';
|
|
700
|
-
put ' %if %str(&_debug) ge
|
|
700
|
+
put ' %if %str(&_debug) ge 128 and &_EXECUTIONTASKS=true %then %do; ';
|
|
701
701
|
put ' put ''>>weboutBEGIN<<''; ';
|
|
702
702
|
put ' %end; ';
|
|
703
703
|
put ' put ''{"SYSDATE" : "'' "&SYSDATE" ''"''; ';
|
|
@@ -812,7 +812,7 @@ data _null_;
|
|
|
812
812
|
put ' memsize=quote(cats(memsize)); ';
|
|
813
813
|
put ' put '',"MEMSIZE" : '' memsize; ';
|
|
814
814
|
put ' put "}"; ';
|
|
815
|
-
put ' %if %str(&_debug) ge
|
|
815
|
+
put ' %if %str(&_debug) ge 128 and &_EXECUTIONTASKS=true %then %do; ';
|
|
816
816
|
put ' put ''>>weboutEND<<''; ';
|
|
817
817
|
put ' %end; ';
|
|
818
818
|
put ' %if %upcase(&fref) ne _WEBOUT and &stream=Y %then %do; ';
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
@file
|
|
3
|
+
@brief Appends a text file to a SASjs Stored Program, Viya SAS program, or
|
|
4
|
+
SAS 9 Stored Process
|
|
5
|
+
@details Extracts the source code from a SASjs Stored Program, Viya SAS
|
|
6
|
+
program (file in SAS Drive), or SAS 9 Stored Process, appends the contents
|
|
7
|
+
of a provided text file, then deletes and recreates the target item with the
|
|
8
|
+
combined content.
|
|
9
|
+
|
|
10
|
+
This is useful for dynamically modifying deployed programs, for example to
|
|
11
|
+
add test-specific configuration or runtime settings.
|
|
12
|
+
|
|
13
|
+
Usage:
|
|
14
|
+
|
|
15
|
+
%* compile macros ;
|
|
16
|
+
filename mc url
|
|
17
|
+
"https://raw.githubusercontent.com/sasjs/core/main/all.sas";
|
|
18
|
+
%inc mc;
|
|
19
|
+
|
|
20
|
+
%* write some content to append;
|
|
21
|
+
filename append temp;
|
|
22
|
+
data _null_;
|
|
23
|
+
file append;
|
|
24
|
+
put "libname mylib '/some/path';";
|
|
25
|
+
run;
|
|
26
|
+
|
|
27
|
+
%* append to existing program;
|
|
28
|
+
%mx_append2pgm(/Public/app/common/settings, inref=append)
|
|
29
|
+
|
|
30
|
+
@param [in] loc The full path to the Viya SAS program, SAS 9 Stored Process,
|
|
31
|
+
or SASjs Stored Program in Drive or Metadata, WITHOUT the .sas extension
|
|
32
|
+
(SASjs only)
|
|
33
|
+
@param [in] inref= (0) Fileref pointing to the content to be appended to the
|
|
34
|
+
target program.
|
|
35
|
+
@param [in] mdebug= (0) Set to 1 to show debug messages in the log
|
|
36
|
+
|
|
37
|
+
<h4> SAS Macros </h4>
|
|
38
|
+
@li mf_getplatform.sas
|
|
39
|
+
@li mf_getuniquefileref.sas
|
|
40
|
+
@li mm_createstp.sas
|
|
41
|
+
@li mm_deletestp.sas
|
|
42
|
+
@li mm_getstpcode.sas
|
|
43
|
+
@li ms_createfile.sas
|
|
44
|
+
@li ms_deletefile.sas
|
|
45
|
+
@li mv_createfile.sas
|
|
46
|
+
@li mv_deletefoldermember.sas
|
|
47
|
+
@li mx_getcode.sas
|
|
48
|
+
|
|
49
|
+
<h4> Related Macros </h4>
|
|
50
|
+
@li mx_append2pgm.test.sas
|
|
51
|
+
@li mx_getcode.sas
|
|
52
|
+
@li mx_createjob.sas
|
|
53
|
+
|
|
54
|
+
@author Allan Bowe
|
|
55
|
+
|
|
56
|
+
**/
|
|
57
|
+
|
|
58
|
+
%macro mx_append2pgm(loc
|
|
59
|
+
,inref=0
|
|
60
|
+
,mdebug=0
|
|
61
|
+
)/*/STORE SOURCE*/;
|
|
62
|
+
|
|
63
|
+
%local platform name shortloc coderef combref work tmpfile viyaref;
|
|
64
|
+
%let platform=%mf_getplatform();
|
|
65
|
+
|
|
66
|
+
%if &mdebug=1 %then %do;
|
|
67
|
+
%put &sysmacroname entry vars:;
|
|
68
|
+
%put _local_;
|
|
69
|
+
%end;
|
|
70
|
+
%if &syscc ne 0 %then %do;
|
|
71
|
+
%put syscc=&syscc - &sysmacroname will not execute in this state;
|
|
72
|
+
%return;
|
|
73
|
+
%end;
|
|
74
|
+
|
|
75
|
+
/* extract name & path from loc */
|
|
76
|
+
data _null_;
|
|
77
|
+
length name shortloc $500;
|
|
78
|
+
loc=symget('loc');
|
|
79
|
+
name=scan(loc,-1,'/');
|
|
80
|
+
shortloc=substr(loc,1,length(loc)-length(name)-1);
|
|
81
|
+
call symputx('name',name,'l');
|
|
82
|
+
call symputx('shortloc',shortloc,'l');
|
|
83
|
+
run;
|
|
84
|
+
|
|
85
|
+
/* create a combined fileref with original + appended content */
|
|
86
|
+
%let combref=%mf_getuniquefileref();
|
|
87
|
+
%let work=%sysfunc(pathname(work));
|
|
88
|
+
%let tmpfile=&combref..sas;
|
|
89
|
+
filename &combref "&work/&tmpfile" lrecl=32000;
|
|
90
|
+
|
|
91
|
+
%if &platform=SASVIYA %then %do;
|
|
92
|
+
/* On Viya, read the SAS program file from SAS Drive using filesrvc */
|
|
93
|
+
%let viyaref=%mf_getuniquefileref();
|
|
94
|
+
filename &viyaref filesrvc folderpath="&shortloc";
|
|
95
|
+
data _null_;
|
|
96
|
+
file &combref lrecl=32000 termstr=crlf;
|
|
97
|
+
infile &viyaref("&name..sas") lrecl=32000 end=last;
|
|
98
|
+
input;
|
|
99
|
+
put _infile_;
|
|
100
|
+
run;
|
|
101
|
+
filename &viyaref clear;
|
|
102
|
+
%symdel _FILESRVC_&viyaref._URI;
|
|
103
|
+
%end;
|
|
104
|
+
%else %do;
|
|
105
|
+
/* For SAS9 and SASJS, use mx_getcode */
|
|
106
|
+
%let coderef=%mf_getuniquefileref();
|
|
107
|
+
%mx_getcode(&loc, outref=&coderef)
|
|
108
|
+
data _null_;
|
|
109
|
+
file &combref lrecl=32000 termstr=crlf;
|
|
110
|
+
infile &coderef lrecl=32000 end=last;
|
|
111
|
+
input;
|
|
112
|
+
put _infile_;
|
|
113
|
+
run;
|
|
114
|
+
filename &coderef clear;
|
|
115
|
+
%end;
|
|
116
|
+
|
|
117
|
+
/* append the new content */
|
|
118
|
+
data _null_;
|
|
119
|
+
file &combref lrecl=32000 termstr=crlf mod;
|
|
120
|
+
infile &inref lrecl=32000;
|
|
121
|
+
input;
|
|
122
|
+
put _infile_;
|
|
123
|
+
run;
|
|
124
|
+
|
|
125
|
+
/* delete and recreate the target item */
|
|
126
|
+
%if &platform=SASJS %then %do;
|
|
127
|
+
%ms_deletefile(&loc..sas)
|
|
128
|
+
%ms_createfile(&loc..sas, inref=&combref, mdebug=&mdebug)
|
|
129
|
+
%end;
|
|
130
|
+
%else %if &platform=SASVIYA %then %do;
|
|
131
|
+
%mv_deletefoldermember(path=&shortloc, name=&name..sas, contenttype=file)
|
|
132
|
+
%mv_createfile(path=&shortloc, name=&name..sas, inref=&combref)
|
|
133
|
+
%end;
|
|
134
|
+
%else %do;
|
|
135
|
+
/* SAS 9 */
|
|
136
|
+
%mm_deletestp(target=&loc)
|
|
137
|
+
%mm_createstp(stpname=&name
|
|
138
|
+
,filename=&tmpfile
|
|
139
|
+
,directory=&work
|
|
140
|
+
,tree=&shortloc
|
|
141
|
+
,stptype=2
|
|
142
|
+
,mDebug=&mdebug
|
|
143
|
+
,minify=NO
|
|
144
|
+
)
|
|
145
|
+
%end;
|
|
146
|
+
|
|
147
|
+
filename &combref clear;
|
|
148
|
+
|
|
149
|
+
%mend mx_append2pgm;
|