refreshlibinfo.sas
Go to the documentation of this file.
1 /**
2  @file refreshlibinfo.sas
3  @brief Refresh the Data Catalog for a particular library
4  @details When showing library info in the VIEW menu, the data is taken from
5  the Data Catalog tables. These may be empty or outdated, and so this service
6  allows end users to run a refresh of the data.
7 
8  <h4> Service Inputs </h4>
9  <h5> lib2refresh </h5>
10  Should contain the libref to be refreshed.
11  |libref:$8.|
12  |---|
13  |SOMELIB|
14 
15  <h4> Service Outputs </h4>
16 
17  <h5> libinfo </h5>
18 
19  |engine $|libname $|paths $|perms $|owners $|schemas $ |libid $|libsize $|table_cnt |
20  |---|---|---|---|---|---|---|---|---|
21  |V9|SOMELIB|"some/path"|rwxrwxr-x|sassrv|` `|` `|636MB|33|
22 
23  <h4> SAS Macros </h4>
24  @li dc_assignlib.sas
25  @li dc_refreshcatalog.sas
26  @li mp_abort.sas
27 
28  @version 9.3
29  @author 4GL Apps Ltd
30  @copyright 4GL Apps Ltd. This code may only be used within Data Controller
31  and may not be re-distributed or re-sold without the express permission of
32  4GL Apps Ltd.
33 **/
34 
35 
36 %mpeinit()
37 
38 %webout(FETCH)
39 
40 %mp_abort(iftrue= (&syscc ne 0)
41  ,msg=%str(syscc=&syscc Problem on startup)
42 )
43 
44 %let libref=;
45 data _null_;
46  set work.lib2refresh;
47  call symputx('libref',libref);
48 run;
49 
50 %mp_abort(iftrue= (&syscc ne 0)
51  ,msg=%str(syscc=&syscc Problem with inputs - was lib2refresh object sent?)
52 )
53 
54 %dc_assignlib(WRITE,&libref)
55 
56 %mp_abort(iftrue= (&syscc ne 0)
57  ,msg=%str(syscc=&syscc after lib assignment)
58 )
59 
60 %dc_refreshcatalog(&libref)
61 
62 %mp_abort(iftrue= (&syscc ne 0)
63  ,msg=%str(syscc=&syscc Problem when running the catalog refresh)
64 )
65 
66 /* get libinfo */
67 proc sql;
68 create table work.libinfo as
69  select a.engine,
70  a.libname,
71  a.paths,
72  a.perms,
73  a.owners,
74  a.schemas,
75  a.libid,
76  b.libsize,
77  b.table_cnt
78  from &mpelib..mpe_datacatalog_libs(where=(&dc_dttmtfmt. lt tx_to)) a
79  inner join &mpelib..mpe_datastatus_libs(where=(&dc_dttmtfmt. lt tx_to)) b
80  on a.libref=b.libref
81  where a.libref="&libref";
82 
83 %webout(OPEN)
84 %webout(OBJ,libinfo)
85 %webout(CLOSE)