@sasjs/core 4.14.0 → 4.15.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/base/mp_gsubfile.sas +5 -0
- package/package.json +1 -1
- package/viya/mv_deleteviyafolder.sas +29 -17
- package/viya/mv_getjobcode.sas +72 -24
- package/viya/mv_getjoblog.sas +25 -56
- package/fcmp/mcf_stpsrv_header.sas +0 -110
package/base/mp_gsubfile.sas
CHANGED
package/package.json
CHANGED
|
@@ -8,10 +8,16 @@
|
|
|
8
8
|
%mv_deleteviyafolder(path=/Public/test)
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
@param path= The full path of the folder to be deleted
|
|
12
|
-
@param access_token_var= The global macro variable to
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
@param [in] path= The full path of the folder to be deleted
|
|
12
|
+
@param [in] access_token_var= (ACCESS_TOKEN) The global macro variable to
|
|
13
|
+
contain the access token
|
|
14
|
+
@param [in] grant_type= (sas_services) Valid values are:
|
|
15
|
+
@li password
|
|
16
|
+
@li authorization_code
|
|
17
|
+
@li detect - will check if access_token exists, if not will use sas_services
|
|
18
|
+
if a SASStudioV session else authorization_code. Default option.
|
|
19
|
+
@li sas_services - will use oauth_bearer=sas_services.
|
|
20
|
+
@param [in] mdebug= (0) Set to 1 to enable DEBUG messages
|
|
15
21
|
|
|
16
22
|
|
|
17
23
|
@version VIYA V.03.04
|
|
@@ -29,6 +35,7 @@
|
|
|
29
35
|
%macro mv_deleteviyafolder(path=
|
|
30
36
|
,access_token_var=ACCESS_TOKEN
|
|
31
37
|
,grant_type=sas_services
|
|
38
|
+
,mdebug=0
|
|
32
39
|
);
|
|
33
40
|
%local oauth_bearer;
|
|
34
41
|
%if &grant_type=detect %then %do;
|
|
@@ -105,14 +112,17 @@ run;
|
|
|
105
112
|
%let libref1a=%mf_getuniquelibref();
|
|
106
113
|
libname &libref1a JSON fileref=&fname1a;
|
|
107
114
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
115
|
+
%if %mf_existds(&libref1a..items_links) %then %do;
|
|
116
|
+
data _null_;
|
|
117
|
+
set &libref1a..items_links;
|
|
118
|
+
if href=:'/folders/folders' then return;
|
|
119
|
+
if rel='deleteResource' then
|
|
120
|
+
call execute('proc http method="DELETE" url='
|
|
121
|
+
!!quote("&base_uri"!!trim(href))
|
|
122
|
+
!!'; headers "Authorization"="Bearer &&&access_token_var" '
|
|
123
|
+
!!' "Accept"="*/*";run; /**/');
|
|
124
|
+
run;
|
|
125
|
+
%end;
|
|
116
126
|
|
|
117
127
|
%put &sysmacroname: perform the delete operation ;
|
|
118
128
|
%local fname2;
|
|
@@ -133,9 +143,11 @@ run;
|
|
|
133
143
|
%end;
|
|
134
144
|
%else %put &sysmacroname: &path successfully deleted;
|
|
135
145
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
filename &
|
|
139
|
-
|
|
146
|
+
%if &mdebug=0 %then %do;
|
|
147
|
+
/* clear refs */
|
|
148
|
+
filename &fname1 clear;
|
|
149
|
+
filename &fname2 clear;
|
|
150
|
+
libname &libref1 clear;
|
|
151
|
+
%end;
|
|
140
152
|
|
|
141
|
-
%mend mv_deleteviyafolder;
|
|
153
|
+
%mend mv_deleteviyafolder;
|
package/viya/mv_getjobcode.sas
CHANGED
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
@li mf_getplatform.sas
|
|
34
34
|
@li mf_getuniquefileref.sas
|
|
35
35
|
@li mv_getfoldermembers.sas
|
|
36
|
-
@li ml_json.sas
|
|
37
36
|
|
|
38
37
|
**/
|
|
39
38
|
|
|
@@ -44,7 +43,7 @@
|
|
|
44
43
|
,grant_type=sas_services
|
|
45
44
|
,mdebug=0
|
|
46
45
|
);
|
|
47
|
-
%local dbg;
|
|
46
|
+
%local dbg bufsize varcnt fname1 fname2 errmsg;
|
|
48
47
|
%if &mdebug=1 %then %do;
|
|
49
48
|
%put &sysmacroname entry vars:;
|
|
50
49
|
%put _local_;
|
|
@@ -104,7 +103,6 @@ run;
|
|
|
104
103
|
)
|
|
105
104
|
|
|
106
105
|
/* prepare request*/
|
|
107
|
-
%local fname1;
|
|
108
106
|
%let fname1=%mf_getuniquefileref();
|
|
109
107
|
proc http method='GET' out=&fname1 &oauth_bearer
|
|
110
108
|
url="&base_uri&joburi";
|
|
@@ -121,30 +119,81 @@ run;
|
|
|
121
119
|
,msg=%str(&SYS_PROCHTTP_STATUS_CODE &SYS_PROCHTTP_STATUS_PHRASE)
|
|
122
120
|
)
|
|
123
121
|
%end;
|
|
124
|
-
|
|
122
|
+
|
|
125
123
|
%let fname2=%mf_getuniquefileref();
|
|
126
|
-
|
|
127
|
-
%let fpath1=%sysfunc(pathname(&fname1));
|
|
128
|
-
%let fpath2=%sysfunc(pathname(&fname2));
|
|
129
|
-
%let fpath3=%sysfunc(pathname(&fname3));
|
|
124
|
+
filename &fname2 temp ;
|
|
130
125
|
|
|
131
|
-
/*
|
|
132
|
-
|
|
133
|
-
/* read using LUA - this allows the code to be of any length */
|
|
126
|
+
/* cannot use lua IO package as not available in Viya 4 */
|
|
127
|
+
/* so use data step to read the JSON until the string `"code":"` is found */
|
|
134
128
|
data _null_;
|
|
135
|
-
file
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
129
|
+
file &fname2 recfm=n;
|
|
130
|
+
infile &fname1 lrecl=1 recfm=n;
|
|
131
|
+
input sourcechar $ 1. @@;
|
|
132
|
+
format sourcechar hex2.;
|
|
133
|
+
retain startwrite 0;
|
|
134
|
+
if startwrite=0 and sourcechar='"' then do;
|
|
135
|
+
reentry:
|
|
136
|
+
input sourcechar $ 1. @@;
|
|
137
|
+
if sourcechar='c' then do;
|
|
138
|
+
reentry2:
|
|
139
|
+
input sourcechar $ 1. @@;
|
|
140
|
+
if sourcechar='o' then do;
|
|
141
|
+
input sourcechar $ 1. @@;
|
|
142
|
+
if sourcechar='d' then do;
|
|
143
|
+
input sourcechar $ 1. @@;
|
|
144
|
+
if sourcechar='e' then do;
|
|
145
|
+
input sourcechar $ 1. @@;
|
|
146
|
+
if sourcechar='"' then do;
|
|
147
|
+
input sourcechar $ 1. @@;
|
|
148
|
+
if sourcechar=':' then do;
|
|
149
|
+
input sourcechar $ 1. @@;
|
|
150
|
+
if sourcechar='"' then do;
|
|
151
|
+
putlog 'code found';
|
|
152
|
+
startwrite=1;
|
|
153
|
+
input sourcechar $ 1. @@;
|
|
154
|
+
end;
|
|
155
|
+
end;
|
|
156
|
+
else if sourcechar='c' then goto reentry2;
|
|
157
|
+
end;
|
|
158
|
+
end;
|
|
159
|
+
else if sourcechar='"' then goto reentry;
|
|
160
|
+
end;
|
|
161
|
+
else if sourcechar='"' then goto reentry;
|
|
162
|
+
end;
|
|
163
|
+
else if sourcechar='"' then goto reentry;
|
|
164
|
+
end;
|
|
165
|
+
else if sourcechar='"' then goto reentry;
|
|
166
|
+
end;
|
|
167
|
+
/* once the `"code":"` string is found, write until unescaped `"` is found */
|
|
168
|
+
if startwrite=1 then do;
|
|
169
|
+
if sourcechar='\' then do;
|
|
170
|
+
input sourcechar $ 1. @@;
|
|
171
|
+
if sourcechar in ('"','\') then put sourcechar char1.;
|
|
172
|
+
else if sourcechar='n' then put '0A'x;
|
|
173
|
+
else if sourcechar='r' then put '0D'x;
|
|
174
|
+
else if sourcechar='t' then put '09'x;
|
|
175
|
+
else if sourcechar='u' then do;
|
|
176
|
+
length uni $4;
|
|
177
|
+
input uni $ 4. @@;
|
|
178
|
+
sourcechar=unicode('\u'!!uni);
|
|
179
|
+
put sourcechar char1.;
|
|
180
|
+
end;
|
|
181
|
+
else do;
|
|
182
|
+
call symputx('errmsg',"Uncaught escape char: "!!sourcechar,'l');
|
|
183
|
+
call symputx('syscc',99);
|
|
184
|
+
stop;
|
|
185
|
+
end;
|
|
186
|
+
end;
|
|
187
|
+
else if sourcechar='"' then stop;
|
|
188
|
+
else put sourcechar char1.;
|
|
189
|
+
end;
|
|
146
190
|
run;
|
|
147
|
-
|
|
191
|
+
|
|
192
|
+
%mp_abort(iftrue=("&syscc"="99")
|
|
193
|
+
,mac=mv_getjobcode
|
|
194
|
+
,msg=%str(&errmsg)
|
|
195
|
+
)
|
|
196
|
+
|
|
148
197
|
/* export to desired destination */
|
|
149
198
|
%if "&outref"="0" %then %do;
|
|
150
199
|
data _null_;
|
|
@@ -169,7 +218,6 @@ run;
|
|
|
169
218
|
/* clear refs */
|
|
170
219
|
filename &fname1 clear;
|
|
171
220
|
filename &fname2 clear;
|
|
172
|
-
filename &fname3 clear;
|
|
173
221
|
%end;
|
|
174
222
|
|
|
175
223
|
%mend mv_getjobcode;
|
package/viya/mv_getjoblog.sas
CHANGED
|
@@ -86,7 +86,8 @@
|
|
|
86
86
|
@li mp_abort.sas
|
|
87
87
|
@li mf_getplatform.sas
|
|
88
88
|
@li mf_existfileref.sas
|
|
89
|
-
@li
|
|
89
|
+
@li mf_getuniquefileref.sas
|
|
90
|
+
@li mf_getuniquelibref.sas
|
|
90
91
|
|
|
91
92
|
**/
|
|
92
93
|
|
|
@@ -95,7 +96,7 @@
|
|
|
95
96
|
,grant_type=sas_services
|
|
96
97
|
,mdebug=0
|
|
97
98
|
);
|
|
98
|
-
%local dbg;
|
|
99
|
+
%local dbg libref1 libref2 loglocation fname1 fname2;
|
|
99
100
|
%if &mdebug=1 %then %do;
|
|
100
101
|
%put &sysmacroname entry vars:;
|
|
101
102
|
%put _local_;
|
|
@@ -154,8 +155,8 @@ options noquotelenmax;
|
|
|
154
155
|
%let base_uri=%mf_getplatform(VIYARESTAPI);
|
|
155
156
|
|
|
156
157
|
/* prepare request*/
|
|
157
|
-
%local fname1;
|
|
158
158
|
%let fname1=%mf_getuniquefileref();
|
|
159
|
+
%let fname2=%mf_getuniquefileref();
|
|
159
160
|
proc http method='GET' out=&fname1 &oauth_bearer
|
|
160
161
|
url="&base_uri&uri";
|
|
161
162
|
headers
|
|
@@ -175,37 +176,19 @@ run;
|
|
|
175
176
|
,msg=%str(&SYS_PROCHTTP_STATUS_CODE &SYS_PROCHTTP_STATUS_PHRASE)
|
|
176
177
|
)
|
|
177
178
|
%end;
|
|
178
|
-
|
|
179
|
-
%let
|
|
180
|
-
|
|
181
|
-
%let fpath1=%sysfunc(pathname(&fname1));
|
|
182
|
-
%let fpath2=%sysfunc(pathname(&fname2));
|
|
183
|
-
%let fpath3=%sysfunc(pathname(&fname3));
|
|
184
|
-
|
|
185
|
-
/* compile the lua JSON module */
|
|
186
|
-
%ml_json()
|
|
187
|
-
/* read using LUA - this allows the code to be of any length */
|
|
179
|
+
|
|
180
|
+
%let libref1=%mf_getuniquelibref();
|
|
181
|
+
libname &libref1 JSON fileref=&fname1;
|
|
188
182
|
data _null_;
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
infile = io.open (sas.symget("fpath1"), "r")
|
|
192
|
-
outfile = io.open (sas.symget("fpath2"), "w")
|
|
193
|
-
io.input(infile)
|
|
194
|
-
local resp=json.decode(io.read())
|
|
195
|
-
local logloc=resp["logLocation"]
|
|
196
|
-
outfile:write(logloc)
|
|
197
|
-
io.close(infile)
|
|
198
|
-
io.close(outfile)
|
|
199
|
-
';
|
|
183
|
+
set &libref1..root;
|
|
184
|
+
call symputx('loglocation',loglocation,'l');
|
|
200
185
|
run;
|
|
201
|
-
|
|
202
|
-
/*
|
|
186
|
+
|
|
187
|
+
/* validate log path*/
|
|
203
188
|
%let errflg=1;
|
|
204
|
-
%let errmsg=No entry in &
|
|
189
|
+
%let errmsg=No loglocation entry in &fname1 fileref;
|
|
205
190
|
data _null_;
|
|
206
|
-
|
|
207
|
-
input;
|
|
208
|
-
uri=cats(_infile_);
|
|
191
|
+
uri=symget('loglocation');
|
|
209
192
|
if length(uri)<12 then do;
|
|
210
193
|
call symputx('errflg',1);
|
|
211
194
|
call symputx('errmsg',"URI is invalid (too short) - '&uri'",'l');
|
|
@@ -232,7 +215,7 @@ run;
|
|
|
232
215
|
|
|
233
216
|
/* we have a log uri - now fetch the log */
|
|
234
217
|
%&dbg.put &sysmacroname: querying &base_uri&logloc/content;
|
|
235
|
-
proc http method='GET' out=&
|
|
218
|
+
proc http method='GET' out=&fname2 &oauth_bearer
|
|
236
219
|
url="&base_uri&logloc/content?limit=10000";
|
|
237
220
|
headers
|
|
238
221
|
%if &grant_type=authorization_code %then %do;
|
|
@@ -243,14 +226,14 @@ run;
|
|
|
243
226
|
|
|
244
227
|
%if &mdebug=1 %then %do;
|
|
245
228
|
%put &sysmacroname: fetching log content from &base_uri&logloc/content;
|
|
246
|
-
data _null_;infile &
|
|
229
|
+
data _null_;infile &fname2;input;putlog _infile_;run;
|
|
247
230
|
%end;
|
|
248
231
|
|
|
249
232
|
%if &SYS_PROCHTTP_STATUS_CODE=400 %then %do;
|
|
250
233
|
/* fetch log from parent session */
|
|
251
234
|
%let logloc=%substr(&logloc,1,%index(&logloc,%str(/jobs/))-1);
|
|
252
235
|
%&dbg.put &sysmacroname: Now querying &base_uri&logloc/log/content;
|
|
253
|
-
proc http method='GET' out=&
|
|
236
|
+
proc http method='GET' out=&fname2 &oauth_bearer
|
|
254
237
|
url="&base_uri&logloc/log/content?limit=10000";
|
|
255
238
|
headers
|
|
256
239
|
%if &grant_type=authorization_code %then %do;
|
|
@@ -260,47 +243,32 @@ run;
|
|
|
260
243
|
run;
|
|
261
244
|
%if &mdebug=1 %then %do;
|
|
262
245
|
%put &sysmacroname: fetching log content from &base_uri&logloc/log/content;
|
|
263
|
-
data _null_;infile &
|
|
246
|
+
data _null_;infile &fname2;input;putlog _infile_;run;
|
|
264
247
|
%end;
|
|
265
248
|
%end;
|
|
266
249
|
|
|
267
250
|
%if &SYS_PROCHTTP_STATUS_CODE ne 200 and &SYS_PROCHTTP_STATUS_CODE ne 201
|
|
268
251
|
%then %do;
|
|
269
252
|
%if &mdebug ne 1 %then %do; /* have already output above */
|
|
270
|
-
data _null_;infile &
|
|
253
|
+
data _null_;infile &fname2;input;putlog _infile_;run;
|
|
271
254
|
%end;
|
|
272
255
|
%mp_abort(mac=&sysmacroname
|
|
273
256
|
,msg=%str(logfetch: &SYS_PROCHTTP_STATUS_CODE &SYS_PROCHTTP_STATUS_PHRASE)
|
|
274
257
|
)
|
|
275
258
|
%end;
|
|
276
|
-
data _null_;
|
|
277
|
-
file "&fpath3..lua";
|
|
278
|
-
put '
|
|
279
|
-
infile = io.open (sas.symget("fpath1"), "r")
|
|
280
|
-
outfile = io.open (sas.symget("fpath2"), "w")
|
|
281
|
-
io.input(infile)
|
|
282
|
-
local resp=json.decode(io.read())
|
|
283
|
-
for i, v in pairs(resp["items"]) do
|
|
284
|
-
outfile:write(v.line,"\n")
|
|
285
|
-
end
|
|
286
|
-
io.close(infile)
|
|
287
|
-
io.close(outfile)
|
|
288
|
-
';
|
|
289
|
-
run;
|
|
290
|
-
%inc "&fpath3..lua";
|
|
291
259
|
|
|
292
|
-
|
|
260
|
+
%let libref2=%mf_getuniquelibref();
|
|
261
|
+
libname &libref2 JSON fileref=&fname2;
|
|
293
262
|
data _null_;
|
|
294
|
-
infile &fname2 end=last;
|
|
295
263
|
file &outref mod;
|
|
296
264
|
if _n_=1 then do;
|
|
297
265
|
put "/** SASJS Viya Job Log Extract start: &uri **/";
|
|
298
266
|
end;
|
|
299
|
-
|
|
300
|
-
put _infile_;
|
|
267
|
+
set &libref2..items end=last;
|
|
301
268
|
%if &mdebug=1 %then %do;
|
|
302
|
-
putlog
|
|
269
|
+
putlog line;
|
|
303
270
|
%end;
|
|
271
|
+
put line;
|
|
304
272
|
if last then do;
|
|
305
273
|
put "/** SASJS Viya Job Log Extract end: &uri **/";
|
|
306
274
|
end;
|
|
@@ -309,7 +277,8 @@ run;
|
|
|
309
277
|
%if &mdebug=0 %then %do;
|
|
310
278
|
filename &fname1 clear;
|
|
311
279
|
filename &fname2 clear;
|
|
312
|
-
|
|
280
|
+
libname &libref1 clear;
|
|
281
|
+
libname &libref2 clear;
|
|
313
282
|
%end;
|
|
314
283
|
%else %do;
|
|
315
284
|
%put &sysmacroname exit vars:;
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
@file
|
|
3
|
-
@brief Provides a replacement for the stpsrv_header function
|
|
4
|
-
@details The stpsrv_header is normally a built-in function, used to set the
|
|
5
|
-
headers for SAS 9 Stored Processes as documented here:
|
|
6
|
-
https://go.documentation.sas.com/doc/en/itechcdc/9.4/stpug/srvhead.htm
|
|
7
|
-
|
|
8
|
-
The purpose of this custom function is to provide a replacement when running
|
|
9
|
-
similar code as a web service against
|
|
10
|
-
[sasjs/server](https://github.com/sasjs/server). It operates by creating a
|
|
11
|
-
text file with the headers. The location of this text file is determined by
|
|
12
|
-
a macro variable (`sasjs_stpsrv_header_loc`) which needs to be injected into
|
|
13
|
-
each service by the calling process, eg:
|
|
14
|
-
|
|
15
|
-
%let sasjs_stpsrv_header_loc = C:/temp/some_uuid/stpsrv_header.txt;
|
|
16
|
-
|
|
17
|
-
Note - the function works by appending headers to the file. If multiple same-
|
|
18
|
-
named headers are provided, they will all be appended - the calling process
|
|
19
|
-
needs to pick up the last one. This will mean removing the attribute if the
|
|
20
|
-
final record has an empty value.
|
|
21
|
-
|
|
22
|
-
The function takes the following (positional) parameters:
|
|
23
|
-
|
|
24
|
-
| PARAMETER | DESCRIPTION |
|
|
25
|
-
|------------|-------------|
|
|
26
|
-
| name $ | name of the header attribute to create|
|
|
27
|
-
| value $ | value of the header attribute|
|
|
28
|
-
|
|
29
|
-
It returns 0 if successful, or -1 if an error occured.
|
|
30
|
-
|
|
31
|
-
Usage:
|
|
32
|
-
|
|
33
|
-
%let sasjs_stpsrv_header_loc=%sysfunc(pathname(work))/stpsrv_header.txt;
|
|
34
|
-
|
|
35
|
-
%mcf_stpsrv_header(wrap=YES, insert_cmplib=YES)
|
|
36
|
-
|
|
37
|
-
data _null_;
|
|
38
|
-
rc=stpsrv_header('Content-type','application/text');
|
|
39
|
-
rc=stpsrv_header('Content-disposition',"attachment; filename=file.txt");
|
|
40
|
-
run;
|
|
41
|
-
|
|
42
|
-
data _null_;
|
|
43
|
-
infile "&sasjs_stpsrv_header_loc";
|
|
44
|
-
input;
|
|
45
|
-
putlog _infile_;
|
|
46
|
-
run;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
@param [out] wrap= (NO) Choose YES to add the proc fcmp wrapper.
|
|
50
|
-
@param [out] lib= (work) The output library in which to create the catalog.
|
|
51
|
-
@param [out] cat= (sasjs) The output catalog in which to create the package.
|
|
52
|
-
@param [out] pkg= (utils) The output package in which to create the function.
|
|
53
|
-
Uses a 3 part format: libref.catalog.package
|
|
54
|
-
@param [out] insert_cmplib= DEPRECATED - The CMPLIB option is checked and
|
|
55
|
-
values inserted only if needed.
|
|
56
|
-
|
|
57
|
-
<h4> SAS Macros </h4>
|
|
58
|
-
@li mcf_init.sas
|
|
59
|
-
|
|
60
|
-
<h4> Related Programs </h4>
|
|
61
|
-
@li mcf_stpsrv_header.test.sas
|
|
62
|
-
@li mp_init.sas
|
|
63
|
-
|
|
64
|
-
**/
|
|
65
|
-
|
|
66
|
-
%macro mcf_stpsrv_header(wrap=NO
|
|
67
|
-
,insert_cmplib=DEPRECATED
|
|
68
|
-
,lib=WORK
|
|
69
|
-
,cat=SASJS
|
|
70
|
-
,pkg=UTILS
|
|
71
|
-
)/*/STORE SOURCE*/;
|
|
72
|
-
%local i var cmpval found;
|
|
73
|
-
%if %mcf_init(stpsrv_header)=1 %then %return;
|
|
74
|
-
|
|
75
|
-
%if &wrap=YES %then %do;
|
|
76
|
-
proc fcmp outlib=&lib..&cat..&pkg;
|
|
77
|
-
%end;
|
|
78
|
-
|
|
79
|
-
function stpsrv_header(name $, value $);
|
|
80
|
-
length loc $128 val $512;
|
|
81
|
-
loc=symget('sasjs_stpsrv_header_loc');
|
|
82
|
-
val=trim(name)!!': '!!value;
|
|
83
|
-
length fref $8;
|
|
84
|
-
rc=filename(fref,loc);
|
|
85
|
-
if (rc ne 0) then return( -1 );
|
|
86
|
-
fid = fopen(fref,'a');
|
|
87
|
-
if (fid = 0) then return( -1 );
|
|
88
|
-
rc=fput(fid, val);
|
|
89
|
-
rc=fwrite(fid);
|
|
90
|
-
rc=fclose(fid);
|
|
91
|
-
rc=filename(fref);
|
|
92
|
-
return(0);
|
|
93
|
-
endsub;
|
|
94
|
-
|
|
95
|
-
%if &wrap=YES %then %do;
|
|
96
|
-
quit;
|
|
97
|
-
%end;
|
|
98
|
-
|
|
99
|
-
/* insert the CMPLIB if not already there */
|
|
100
|
-
%let cmpval=%sysfunc(getoption(cmplib));
|
|
101
|
-
%let found=0;
|
|
102
|
-
%do i=1 %to %sysfunc(countw(&cmpval,%str( %(%))));
|
|
103
|
-
%let var=%scan(&cmpval,&i,%str( %(%)));
|
|
104
|
-
%if &var=&lib..&cat %then %let found=1;
|
|
105
|
-
%end;
|
|
106
|
-
%if &found=0 %then %do;
|
|
107
|
-
options insert=(CMPLIB=(&lib..&cat));
|
|
108
|
-
%end;
|
|
109
|
-
|
|
110
|
-
%mend mcf_stpsrv_header;
|