@sasjs/core 7.1.2 → 7.1.3
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 +1 -1
- package/viya/mv_getjobresult.sas +43 -10
package/package.json
CHANGED
package/viya/mv_getjobresult.sas
CHANGED
|
@@ -72,6 +72,11 @@
|
|
|
72
72
|
engine. Example values:
|
|
73
73
|
@li WEBOUT_JSON
|
|
74
74
|
@li WEBOUT_TXT
|
|
75
|
+
A job whose webout is a binary file registers it under its own name -
|
|
76
|
+
`_webout.pdf`, `_webout.xlsx` and so on - and a dotted key cannot be
|
|
77
|
+
requested through this parameter. When the requested member is absent the
|
|
78
|
+
macro falls back to the first `_WEBOUT*` member of the results that holds a
|
|
79
|
+
files uri, so a binary webout is returned without the caller naming it.
|
|
75
80
|
|
|
76
81
|
@param [out] outref= (0) The output fileref to which to write the results
|
|
77
82
|
@param [out] outlib= (0) The output library to which to assign the results
|
|
@@ -99,12 +104,10 @@
|
|
|
99
104
|
,outref=0
|
|
100
105
|
,outlib=0
|
|
101
106
|
);
|
|
102
|
-
%local dbg;
|
|
103
107
|
%if &mdebug=1 %then %do;
|
|
104
108
|
%put &sysmacroname entry vars:;
|
|
105
109
|
%put _local_;
|
|
106
110
|
%end;
|
|
107
|
-
%else %let dbg=*;
|
|
108
111
|
|
|
109
112
|
%local oauth_bearer;
|
|
110
113
|
%if &grant_type=detect %then %do;
|
|
@@ -180,15 +183,49 @@ run;
|
|
|
180
183
|
%end;
|
|
181
184
|
|
|
182
185
|
/* extract results link */
|
|
183
|
-
%local lib1 resuri;
|
|
186
|
+
%local lib1 resuri resname resfall want;
|
|
187
|
+
%let resfall=0;
|
|
188
|
+
%let want=%upcase(_&result);
|
|
184
189
|
%let lib1=%mf_getuniquelibref();
|
|
185
190
|
libname &lib1 JSON fileref=&fname1;
|
|
191
|
+
/* The member is located by name rather than referenced by name: a results
|
|
192
|
+
* table with no such column cannot be addressed in a data step at all. A
|
|
193
|
+
* binary webout registers itself as _webout.pdf / .xlsx / .zip, which
|
|
194
|
+
* result= cannot express, so when the requested member is missing the first
|
|
195
|
+
* _WEBOUT* column holding a files uri is taken instead - a job that
|
|
196
|
+
* registered more than one binary member cannot steer this, so only one
|
|
197
|
+
* binary member per job is supported. */
|
|
186
198
|
data _null_;
|
|
187
199
|
set &lib1..results;
|
|
188
|
-
|
|
189
|
-
|
|
200
|
+
array _chars{*} _character_;
|
|
201
|
+
length _name $32 _val $512;
|
|
202
|
+
do _i=1 to dim(_chars);
|
|
203
|
+
_name=vname(_chars{_i});
|
|
204
|
+
if upcase(_name)=symget('want') then do;
|
|
205
|
+
_val=_chars{_i};
|
|
206
|
+
leave;
|
|
207
|
+
end;
|
|
208
|
+
end;
|
|
209
|
+
if _val eq '' then do _i=1 to dim(_chars);
|
|
210
|
+
_name=vname(_chars{_i});
|
|
211
|
+
if _chars{_i}=:'/files/' and upcase(_name)=:'_WEBOUT' then do;
|
|
212
|
+
_val=_chars{_i};
|
|
213
|
+
call symputx('resfall',1,'l');
|
|
214
|
+
leave;
|
|
215
|
+
end;
|
|
216
|
+
end;
|
|
217
|
+
if _val ne '' then do;
|
|
218
|
+
call symputx('resuri',_val,'l');
|
|
219
|
+
call symputx('resname',_name,'l');
|
|
220
|
+
end;
|
|
221
|
+
%if &mdebug=1 %then %do;
|
|
222
|
+
putlog "&sysmacroname results: " (_all_)(=);
|
|
223
|
+
%end;
|
|
190
224
|
run;
|
|
191
|
-
%if
|
|
225
|
+
%if &mdebug=1 and &resfall=1 %then %do;
|
|
226
|
+
%put &sysmacroname: _&result was not registered, using &resname;
|
|
227
|
+
%end;
|
|
228
|
+
%if "%superq(resuri)" eq "" or "%superq(resuri)" eq "." %then %do;
|
|
192
229
|
/* The requested result was not registered - typical for a canceled
|
|
193
230
|
* job whose session ended before the result file was created (eg a
|
|
194
231
|
* job aborted by design, or a job that failed on session creation).
|
|
@@ -218,10 +255,6 @@ run;
|
|
|
218
255
|
%end;
|
|
219
256
|
%return;
|
|
220
257
|
%end;
|
|
221
|
-
%mp_abort(iftrue=("&resuri"=".")
|
|
222
|
-
,mac=&sysmacroname
|
|
223
|
-
,msg=%str(Variable _&result did not exist in the response json)
|
|
224
|
-
)
|
|
225
258
|
|
|
226
259
|
/* extract results */
|
|
227
260
|
%local fname2;
|