Loading...
Searching...
No Matches
mpeinit.sas
Go to the documentation of this file.
1/**
2 @file mpeinit.sas
3 @brief Initialisation file for Data Controller- sets SASAUTOs etc
4 @details Runs at the beginning of every service. Used to configure settings,
5 options and macro variables. Requires the staging area and DC library to be
6 preconfigured.
7
8 <h4> SAS Macros </h4>
9 @li dc_getsettings.sas
10 @li mf_fmtdttm.sas
11 @li mf_getuser.sas
12 @li mp_abort.sas
13 @li mp_init.sas
14
15 @param fetch= Fetch the SASjs tables. Use NO if not loading SASjs content,
16 eg for file upload.
17
18 @version 9.3
19 @author 4GL Apps Ltd
20 @copyright 4GL Apps Ltd. This code may only be used within Data Controller
21 and may not be re-distributed or re-sold without the express permission of
22 4GL Apps Ltd.
23**/
24
25
26%macro mpeinit(fetch=YES);
27%global mpeinit
28 mpeadmins /* group with unrestricted Meditor access */
29 mpelocapprovals /* location for landing and staging files */
30 mpelib /* location of configuration tables for DC */
31 dc_repo_users /* location of user / group metadata */
32 /* extracted in dc_getsettings */
33 dc_activation_key
34 dc_licence_key
35 dc_locale
36 dc_request_logs
37 dc_restrict_viewer
38 dc_dttmtfmt /* can be overridden in dc_getsettings */
39 _debug /* automatic variable when provided in URL */
40 sasjs_mdebug /* used to show extra info when _debug is enabled */
41 sqlrc /* avoid errors when using DI jobs in HOOK scripts */
42 ;
43
44%if &mpeinit=1 %then %return;
45%else %let mpeinit=1;
46%mp_abort(iftrue= (&syscc ne 0)
47 ,mac=&_program
48 ,msg=%str(Problem on service startup (&syswarningtext &syserrortext))
49)
50
51%mp_init()
52
53%if &fetch=YES %then %do;
54 %webout(FETCH)
55%end;
56
57%global _CLIENTNAME;
58%mp_abort(iftrue= (&_CLIENTNAME=SAS Enterprise Guide)
59 ,mac=&_program..sas
60 ,msg=%str(Data Controller is a web app and should not be executed from EG)
61)
62
63options urlencoding=utf8 nobomfile lrecl=32767;
64
65%let perf=%sysfunc(datetime());
66%put perfdiff: 0;
67
68%let dc_locale=SYSTEM; /* default if not set */
69
70/**
71 * E8601DT26.6 has widest database support - but not all SAS flavours can
72 * handle it. Override in the settings STP if needed.
73 */
74data _null_;
75 dc_dttmtfmt='"%sysfunc(datetime(),'!!"%mf_fmtdttm()"!!')"dt';
76 call symputx('dc_dttmtfmt',dc_dttmtfmt);
77 put dc_dttmtfmt=;
78run;
79
80%put &=dc_dttmtfmt;
81
82%mp_abort(iftrue= (&syscc ne 0)
83 ,mac=&_program
84 ,msg=%str(syscc=&syscc prior to dc_getsettings)
85)
86
87%dc_getsettings()
88
89%mp_abort(iftrue= (&syscc ne 0)
90 ,mac=&_program
91 ,msg=%str(syscc=&syscc after dc_getsettings)
92)
93
94data _null_;
95 set &DC_LIBREF..mpe_config(where=(
96 var_scope="DC"
97 and &dc_dttmtfmt lt tx_to
98 and var_active=1
99 ));
100 call symputx(var_name,var_value,'G');
101 putlog var_name "=" var_value;
102run;
103
104%let mpelib=&dc_libref;
105%let mpeadmins=&dc_admin_group;
106%let mpelocapprovals=&dc_staging_area;
107%let dc_repo_users=&dc_repo_users;
108
109%if &dc_locale ne SYSTEM %then %do;
110 options locale=&dc_locale;
111%end;
112
113%mp_abort(iftrue= (&syscc ne 0)
114 ,mac=&_program..sas
115 ,msg=%str(Problem during compilation or with STP precode (&syswarningtext))
116)
117
118%if "&_debug"="2477" or "&_debug"="fields,log,trace" or "&_debug"="131"
119%then %do;
120 %let sasjs_mdebug=1;
121%end;
122
123%mend mpeinit;