mpe_runhook.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Runs a hook from MPE_TABLES
4  @details Takes a hook script, identifies whether it is a
5  SAS Program or Logical Job / STP and executes the corresponding
6  code.
7 
8  <h4> SAS Macros </h4>
9  @li dc_getservicecode.sas
10  @li mf_getapploc.sas
11  @li mp_abort.sas
12  @li mp_include.sas
13 
14  @author 4GL Apps Ltd
15  @copyright 4GL Apps Ltd. This code may only be used within Data Controller
16  and may not be re-distributed or re-sold without the express permission of
17  4GL Apps Ltd.
18 **/
19 
20 
21 %macro mpe_runhook(hookvar);
22 %local pgmloc pgmtype;
23 %let pgmtype=0;
24 %put &sysmacroname: &=hookvar;
25 %if %length(&&&hookvar)>0 %then %do;
26  %put &sysmacroname: Executing &&&hookvar;
27  data _null_;
28  rule_value=symget("&hookvar");
29  if scan(upcase(rule_value),-1,'.')='SAS' then do;
30  call symputx('pgmtype','PGM');
31  call symputx('pgmloc',rule_value);
32  end;
33  else do;
34  apploc="%mf_getapploc()";
35  if substr(rule_value,1,1) ne '/'
36  then rule_value=cats(apploc,'/',rule_value);
37  call symputx('pgmloc',rule_value);
38  call symputx('pgmtype','JOB');
39  end;
40  run;
41 
42  %if &pgmtype=PGM %then %do;
43  filename sascode "&pgmloc";
44  %end;
45  %else %do;
46  %dc_getservicecode(loc=&pgmloc
47  ,outref=sascode
48  )
49  %end;
50 
51  /* the below script will need to modify work.STAGING_DS */
52  %local x; %let x=; /* legacy feature */
53  %mp_include(sascode)
54 
55 %end;
56 
57 %mend mpe_runhook;