Loading...
Searching...
No Matches
refreshcatalog.sas
Go to the documentation of this file.
1/**
2 @file refreshcatalog.sas
3 @brief Refreshes the library data catalog
4 @details A library may be passed in a LIBREF url param.
5 Requires membership of the DC administrators group.
6
7 <h4> SAS Macros </h4>
8 @li mpeinit.sas
9 @li dc_refreshcatalog.sas
10 @li mf_getuser.sas
11 @li mpe_getgroups.sas
12 @li mp_abort.sas
13 @li mp_validatecol.sas
14 @li mpeterm.sas
15
16 @version 9.3
17 @author 4GL Apps Ltd
18 @copyright 4GL Apps Ltd. This code may only be used within Data Controller
19 and may not be re-distributed or re-sold without the express permission of
20 4GL Apps Ltd.
21
22**/
23%global libref;
24%mpeinit()
25
26/**
27 * libref is a request input used in dc_assignlib and catalog queries -
28 * it must be a well-formed libref before use. Read with symget (never
29 * re-resolved) and validated in a data step.
30 */
31%let is_lib=0;
32data _null_;
33 length _libref $8;
34 _libref=coalescec(symget('libref'),'');
35 /* an absent libref is a valid, full catalog refresh */
36 if missing(_libref) then do;
37 call symputx('is_lib',1,'l');
38 call symputx('libref','','g');
39 stop;
40 end;
41 %mp_validatecol(_libref,ISLIB,is_lib)
42 if is_lib=0 then putlog 'ERR' 'OR: Invalid libref:' _libref;
43 call symputx('is_lib',is_lib,'l');
44 if is_lib=1 then call symputx('libref',upcase(_libref),'g');
45run;
46
47%mp_abort(iftrue= (&is_lib ne 1)
48 ,mac=&_program..sas
49 ,msg=%str(Invalid libref)
50)
51
52/* check user is in admin group */
53%let cnt=0;
54%mpe_getgroups(user=%mf_getuser(),outds=work.usergroups)
55proc sql noprint;
56select count(*) into:cnt
57 from usergroups
58 where groupname="&mpeadmins";
59%mp_abort(iftrue= (&cnt=0)
60 ,mac=&_program
61 ,msg=%str(This service is only available to &mpeadmins members)
62)
63
64%dc_refreshcatalog(&libref)
65
66
67data sasparams;
68 length msg $64;
69 msg='Catalog Refresh Complete';
70run;
71
72%webout(OPEN)
73%webout(OBJ,sasparams)
74%webout(CLOSE)
75
76%mpeterm()