Loading...
Searching...
No Matches
mpe_action.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Resolves the ACTION a makedata request is asking for
4 @details
5 @deprecated This macro is no longer called. makedata reads ACTION from its
6 input table with call symputx, the way it already read DCPATH and ADMIN, and
7 its two refusals test the value directly - so there is nothing left to
8 resolve. It is kept for one release rather than deleted, because a
9 deployment that ships its own services may still call it; remove it after
10 that.
11
12 makedata answers the deploy screen's filesystem questions as well as creating
13 the configuration tables, so the action has to be resolved before anything
14 runs. It arrives one of two ways:
15
16 @li as a column of the input table (the adapter route, and the only one that
17 works on SASjs Server - a form field or query parameter is not delivered to
18 the program there);
19 @li as the macro variable `action`, which is what a URL parameter becomes on
20 a platform that does deliver one, and which the configurator's link sets.
21
22 The macro variable is therefore read BEFORE anything is assigned over it: a
23 default written first would overwrite the incoming value and the parameter
24 would never take effect. A value that is absent is reported as MISSING and
25 one outside the closed list as BAD, so the caller can refuse them with its
26 own messages rather than this macro aborting.
27
28 @param [out] outvar= (action) Global macro variable to receive the action.
29 Set to MAKEDATA, DIRLIST, WRITECHECK, MISSING or BAD.
30
31 @version 9.2
32 @author 4GL Apps Ltd
33 @copyright 4GL Apps Ltd. This code may only be used within Data Controller
34 and may not be re-distributed or re-sold without the express permission of
35 4GL Apps Ltd.
36
37 @sasjslint {"maxLineLength": 80}
38
39**/
40
41%macro mpe_action(outvar=action);
42%local incoming resolved;
43%let incoming=;
44%let resolved=MISSING;
45
46/* capture any incoming value before this macro assigns its own - symget reads
47 it without resolving macro text in it, and symexist keeps a missing name out
48 of the log */
49data _null_;
50 if symexist('action') then call symputx('incoming',symget('action'),'l');
51run;
52
53/* a column of the input table wins over the macro variable. The two cases are
54 separate steps: a SET inside an IF is still executed, so the "no input table"
55 case has to be compiled without one */
56%if %sysfunc(exist(work.fromjs))=1 %then %do;
57data _null_;
58 set work.fromjs(obs=1);
59 if not missing(action) then
60 call symputx('incoming',upcase(strip(cats(action))),'l');
61run;
62%end;
63
64data _null_;
65 length _act $10;
66 _act=upcase(strip(symget('incoming')));
67 /* absent is a different refusal from unrecognised */
68 if missing(_act) then _act='MISSING';
69 if _act not in ('MAKEDATA','DIRLIST','WRITECHECK') and _act ne 'MISSING'
70 then _act='BAD';
71 call symputx('resolved',_act,'l');
72run;
73
74data _null_;
75 call symputx("&outvar",symget('resolved'),'g');
76run;
77
78%mend mpe_action;