mirror of
https://github.com/sasjs/core.git
synced 2025-12-11 06:24:35 +00:00
Merge pull request #34 from sasjs/issue33
feat: adding sysvlong to the webout macros, also updating documentati…
This commit is contained in:
@@ -26,7 +26,8 @@
|
||||
@param action Either FETCH, OPEN, ARR, OBJ or CLOSE
|
||||
@param ds The dataset to send back to the frontend
|
||||
@param dslabel= value to use instead of the real name for sending to JSON
|
||||
@param fmt= set to N to send back unformatted values
|
||||
@param fmt=(Y) Set to N to send back unformatted values
|
||||
@param fref=(_webout) The fileref to which to write the JSON
|
||||
|
||||
@version 9.3
|
||||
@author Allan Bowe
|
||||
@@ -91,7 +92,7 @@
|
||||
%end;
|
||||
|
||||
%else %if &action=ARR or &action=OBJ %then %do;
|
||||
%mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt
|
||||
%mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt,jref=&fref
|
||||
,engine=DATASTEP,dbg=%str(&_debug)
|
||||
)
|
||||
%end;
|
||||
@@ -150,6 +151,8 @@
|
||||
put ",""SYSHOSTNAME"" : ""&syshostname"" ";
|
||||
put ",""SYSJOBID"" : ""&sysjobid"" ";
|
||||
put ",""SYSSITE"" : ""&syssite"" ";
|
||||
sysvlong=quote(trim(symget('sysvlong')));
|
||||
put ',"SYSVLONG" : ' sysvlong;
|
||||
put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" ";
|
||||
put ',"END_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '" ';
|
||||
put "}" @;
|
||||
@@ -159,4 +162,4 @@
|
||||
run;
|
||||
%end;
|
||||
|
||||
%mend;
|
||||
%mend mm_webout;
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
"meta",
|
||||
"metax",
|
||||
"viya",
|
||||
"lua"
|
||||
"lua",
|
||||
"tests/base"
|
||||
],
|
||||
"docConfig": {
|
||||
"displayMacroCore": false,
|
||||
@@ -16,6 +17,13 @@
|
||||
"readMe": "../../README.md"
|
||||
}
|
||||
},
|
||||
"testConfig": {
|
||||
"initProgram": "tests/testinit.sas",
|
||||
"termProgram": "tests/testterm.sas",
|
||||
"macroVars": {
|
||||
"mcTestAppLoc": "/Public/temp/macrocore"
|
||||
}
|
||||
},
|
||||
"defaultTarget": "viya",
|
||||
"targets": [
|
||||
{
|
||||
@@ -27,22 +35,18 @@
|
||||
"deployServicePack": true
|
||||
},
|
||||
"macroFolders": [
|
||||
"base",
|
||||
"meta",
|
||||
"metax",
|
||||
"viya",
|
||||
"lua",
|
||||
"tests/base",
|
||||
"tests/viya"
|
||||
],
|
||||
"contextName": "SAS Job Execution compute context",
|
||||
"testConfig": {
|
||||
"initProgram": "tests/testinit.sas",
|
||||
"termProgram": "tests/testterm.sas",
|
||||
"macroVars": {
|
||||
"mcTestAppLoc": "/Public/temp/macrocore"
|
||||
}
|
||||
}
|
||||
"contextName": "SAS Job Execution compute context"
|
||||
},
|
||||
{
|
||||
"name": "sas9",
|
||||
"serverUrl": "https://sas.analytium.co.uk:8343",
|
||||
"serverType": "SAS9",
|
||||
"appLoc": "/Shared Data/temp/macrocore",
|
||||
"macroFolders": [
|
||||
"tests/meta"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
35
tests/meta/mm_webout.test.sas
Normal file
35
tests/meta/mm_webout.test.sas
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
@file
|
||||
@brief Testing mm_webout macro
|
||||
|
||||
<h4> SAS Macros </h4>
|
||||
@li mf_getuniquefileref.sas
|
||||
@li mm_webout.sas
|
||||
@li mp_assert.sas
|
||||
|
||||
**/
|
||||
|
||||
|
||||
%let fref=%mf_getuniquefileref();
|
||||
%global _metaperson;
|
||||
data some datasets;
|
||||
x=1;
|
||||
run;
|
||||
%mm_webout(OPEN,fref=&fref)
|
||||
%mm_webout(ARR,some,fref=&fref)
|
||||
%mm_webout(OBJ,datasets,fref=&fref)
|
||||
%mm_webout(CLOSE,fref=&fref)
|
||||
|
||||
libname test JSON (&fref);
|
||||
data root;
|
||||
set test.root;
|
||||
call symputx('checkval',sysvlong);
|
||||
run;
|
||||
data alldata;
|
||||
set test.alldata;
|
||||
run;
|
||||
|
||||
%mp_assert(
|
||||
iftrue=(%str(&checkval)=%str(&sysvlong)),
|
||||
desc=Check if the sysvlong value was created
|
||||
)
|
||||
41
tests/viya/mv_webout.test.sas
Normal file
41
tests/viya/mv_webout.test.sas
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
@file
|
||||
@brief Testing mm_webout macro
|
||||
|
||||
<h4> SAS Macros </h4>
|
||||
@li mf_getuniquefileref.sas
|
||||
@li mv_webout.sas
|
||||
@li mp_assert.sas
|
||||
|
||||
**/
|
||||
|
||||
|
||||
%let fref=%mf_getuniquefileref();
|
||||
%global _metaperson;
|
||||
data some datasets;
|
||||
x=1;
|
||||
run;
|
||||
%mv_webout(OPEN,fref=&fref,stream=N)
|
||||
%mv_webout(ARR,some,fref=&fref,stream=N)
|
||||
%mv_webout(OBJ,datasets,fref=&fref,stream=N)
|
||||
%mv_webout(CLOSE,fref=&fref,stream=N)
|
||||
|
||||
data _null_;
|
||||
infile &fref;
|
||||
input;
|
||||
putlog _infile_;
|
||||
run;
|
||||
|
||||
libname test JSON (&fref);
|
||||
data root;
|
||||
set test.root;
|
||||
call symputx('checkval',sysvlong);
|
||||
run;
|
||||
data alldata;
|
||||
set test.alldata;
|
||||
run;
|
||||
|
||||
%mp_assert(
|
||||
iftrue=(%str(&checkval)=%str(&sysvlong)),
|
||||
desc=Check if the sysvlong value was created
|
||||
)
|
||||
@@ -23,9 +23,10 @@
|
||||
@param action Either OPEN, ARR, OBJ or CLOSE
|
||||
@param ds The dataset to send back to the frontend
|
||||
@param _webout= fileref for returning the json
|
||||
@param fref= temp fref
|
||||
@param fref=(_mvwtemp) Temp fileref to which to write the output
|
||||
@param dslabel= value to use instead of the real name for sending to JSON
|
||||
@param fmt= change to N to strip formats from output
|
||||
@param fmt=(Y) change to N to strip formats from output
|
||||
@param stream=(Y) Change to N if not streaming to _webout
|
||||
|
||||
<h4> SAS Macros </h4>
|
||||
@li mp_jsonout.sas
|
||||
@@ -35,7 +36,7 @@
|
||||
@author Allan Bowe, source: https://github.com/sasjs/core
|
||||
|
||||
**/
|
||||
%macro mv_webout(action,ds,fref=_mvwtemp,dslabel=,fmt=Y);
|
||||
%macro mv_webout(action,ds,fref=_mvwtemp,dslabel=,fmt=Y,stream=Y);
|
||||
%global _webin_file_count _webin_fileuri _debug _omittextlog _webin_name
|
||||
sasjs_tables SYS_JES_JOB_URI;
|
||||
%if %index("&_debug",log) %then %let _debug=131;
|
||||
@@ -214,14 +215,16 @@
|
||||
put ",""SYSERRORTEXT"" : ""&syserrortext"" ";
|
||||
put ",""SYSHOSTNAME"" : ""&syshostname"" ";
|
||||
put ",""SYSSITE"" : ""&syssite"" ";
|
||||
sysvlong=quote(trim(symget('sysvlong')));
|
||||
put ',"SYSVLONG" : ' sysvlong;
|
||||
put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" ";
|
||||
put ',"END_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '" ';
|
||||
put "}";
|
||||
|
||||
%if %upcase(&fref) ne _WEBOUT %then %do;
|
||||
%if %upcase(&fref) ne _WEBOUT and &stream=Y %then %do;
|
||||
data _null_; rc=fcopy("&fref","_webout");run;
|
||||
%end;
|
||||
|
||||
%end;
|
||||
|
||||
%mend;
|
||||
%mend mv_webout;
|
||||
|
||||
Reference in New Issue
Block a user