@sasjs/core 4.59.10 → 4.60.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
@@ -32,5 +32,5 @@
32
32
  "lint": "npx @sasjs/cli lint",
33
33
  "prepare": "git rev-parse --git-dir && git config core.hooksPath ./.git-hooks || true"
34
34
  },
35
- "version": "4.59.10"
35
+ "version": "4.60.0"
36
36
  }
@@ -118,6 +118,7 @@ libname &libref1a JSON fileref=&fname1a;
118
118
  /* %put Getting object uri from &libref1a..items; */
119
119
  data _null_;
120
120
  length contenttype name $1000;
121
+ call missing(of _all_);
121
122
  set &libref1a..items;
122
123
  if contenttype='jobDefinition' and upcase(name)="%upcase(&name)" then do;
123
124
  call symputx('uri',cats("&base_uri",uri),'l');
@@ -0,0 +1,111 @@
1
+ /**
2
+ @file mx_createjob.sas
3
+ @brief Create a job in SAS 9, Viya or SASjs
4
+ @details Creates a Stored Process in SAS 9, a Job Execution Service in SAS
5
+ Viya, or a Stored Program on SASjs Server - depending on the executing
6
+ environment.
7
+
8
+ Usage:
9
+
10
+ %* compile macros ;
11
+ filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
12
+ %inc mc;
13
+
14
+ %* write some code;
15
+ filename ft15f001 temp;
16
+ parmcards4;
17
+ data example1;
18
+ set sashelp.class;
19
+ run;
20
+ ;;;;
21
+
22
+ %* create the job;
23
+ %mx_createjob(path=/Public/app/jobs,name=myjob,replace=YES)
24
+
25
+ <h4> SAS Macros </h4>
26
+ @li mf_getplatform.sas
27
+ @li mm_createstp.sas
28
+ @li ms_createfile.sas
29
+ @li mv_createjob.sas
30
+
31
+ @param [in,out] path= The full folder path where the job will be created
32
+ @param [in,out] name= Job name. Avoid spaces.
33
+ @param [in] desc= The description of the job (optional)
34
+ @param [in] precode= Space separated list of filerefs, pointing to the code
35
+ that needs to be attached to the beginning of the job (optional)
36
+ @param [in] code= (ft15f001) Space seperated fileref(s) of the actual code to
37
+ be added
38
+ @param [in] replace= (YES) Select YES to replace any existing job in that
39
+ location
40
+ @param [in] mDebug= (0) set to 1 to show debug messages in the log
41
+
42
+ @author Allan Bowe
43
+
44
+ <h4> Related Macros </h4>
45
+ @li mx_createjob.test.sas
46
+ @li mx_createwebservice.sas
47
+
48
+ **/
49
+
50
+ %macro mx_createjob(path=HOME
51
+ ,name=initJob
52
+ ,precode=
53
+ ,code=ft15f001
54
+ ,desc=This job was created by the mx_createjob macro
55
+ ,replace=YES
56
+ ,mdebug=0
57
+ )/*/STORE SOURCE*/;
58
+
59
+ %if &syscc ge 4 %then %do;
60
+ %put syscc=&syscc - &sysmacroname will not execute in this state;
61
+ %return;
62
+ %end;
63
+
64
+ /* combine precode and code into a single file */
65
+ %local tempref x fref freflist;
66
+ %let tempref=%mf_getuniquefileref();
67
+ %local work tmpfile;
68
+ %let work=%sysfunc(pathname(work));
69
+ %let tmpfile=&tempref..sas;
70
+ filename &tempref "&work/&tmpfile";
71
+ %let freflist=&precode &code ;
72
+ %do x=1 %to %sysfunc(countw(&freflist));
73
+ %let fref=%scan(&freflist,&x);
74
+ %put &sysmacroname: adding &fref;
75
+ data _null_;
76
+ file &tempref lrecl=3000 termstr=crlf mod;
77
+ infile &fref lrecl=3000;
78
+ input;
79
+ put _infile_;
80
+ run;
81
+ %end;
82
+
83
+ %local platform; %let platform=%mf_getplatform();
84
+ %if &platform=SASVIYA %then %do;
85
+ %if "&path"="HOME" %then %let path=/Users/&sysuserid/My Folder;
86
+ %mv_createjob(path=&path
87
+ ,name=&name
88
+ ,code=&tempref
89
+ ,desc=&desc
90
+ ,replace=&replace
91
+ )
92
+ %end;
93
+ %else %if &platform=SASJS %then %do;
94
+ %if "&path"="HOME" %then %let path=/Users/&_sasjs_username/My Folder;
95
+ %ms_createfile(&path/&name..sas
96
+ ,inref=&tempref
97
+ ,mdebug=&mdebug
98
+ )
99
+ %end;
100
+ %else %do;
101
+ %if "&path"="HOME" %then %let path=/User Folders/&_METAPERSON/My Folder;
102
+ %mm_createstp(stpname=&name
103
+ ,filename=&tmpfile
104
+ ,directory=&work
105
+ ,tree=&path
106
+ ,stpdesc=&desc
107
+ ,mDebug=&mdebug
108
+ )
109
+ %end;
110
+ filename &tempref clear;
111
+ %mend mx_createjob;
@@ -48,6 +48,9 @@ Usage:
48
48
 
49
49
  @author Allan Bowe
50
50
 
51
+ <h4> Related Macros </h4>
52
+ @li mx_createjob.sas
53
+
51
54
  **/
52
55
 
53
56
  %macro mx_createwebservice(path=HOME