Loading...
Searching...
No Matches
getchangeinfo.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief testing getchangeinfo service
4
5 <h4> SAS Macros </h4>
6 @li mx_execute.sas
7 @li mp_assert.sas
8 @li mp_assertcolvals.sas
9 @li mf_getuniquefileref.sas
10
11**/
12
13%let _program=&appLoc/services/public/getchangeinfo;
14
15/**
16 * First part - stage some data (for diffing)
17 */
18data work.sascontroltable;
19 action='LOAD';
20 message="getdiffs prep";
21 libds="&dclib..MPE_X_TEST";
22 output;
23 stop;
24run;
25proc sql noprint;
26select max(primary_key_field) into: maxpk from &dclib..mpe_x_test;
27data work.jsdata;
28 set &dclib..mpe_x_test(rename=(
29 some_date=dt2 SOME_DATETIME=dttm2 SOME_TIME=tm2)
30 );
31 /* for now, the adapter sends these as strings */
32 some_date=put(dt2,date9.);
33 SOME_DATETIME=put(dttm2,datetime19.);
34 some_time=put(tm2,time.);
35 drop dt2 dttm2 tm2;
36 _____DELETE__THIS__RECORD_____='No';
37 if _n_=1 then do;
38 primary_key_field=sum(&maxpk,1);
39 some_char=' leadingblanks';
40 some_num=._;
41 output;
42 end;
43 else if _n_<3 then do;
44 SOME_NUM=ranuni(0);
45 end;
46 else stop;
47run;
48
49%mx_execute(&appLoc/services/editors/stagedata,
50 viyacontext=&defaultcontext,
51 inputdatasets=work.jsdata work.sascontroltable,
52 outlib=web1,
53 mdebug=&sasjs_mdebug
54)
55
56%let status=0;
57data work.sasparams;
58 set web1.sasparams;
59 putlog (_all_)(=);
60 if status='SUCCESS' then call symputx('status',1);
61 call symputx('dsid',dsid);
62run;
63%mp_assert(
64 iftrue=(&status=1 and &syscc=0),
65 desc=Checking successful submission
66)
67
68
69/* now call getchangeinfo */
70%let f3=%mf_getuniquefileref();
71data _null_;
72 file &f3 termstr=crlf;
73 put 'TABLE:$43.';
74 put "&dsid";
75run;
76%mx_execute(&_program,
77 viyacontext=&defaultcontext,
78 inputfiles=&f3:sascontroltable,
79 outlib=web3,
80 mdebug=&sasjs_mdebug
81)
82
83data work.jsparams;
84 set web3.jsparams;
85 putlog (_all_)(=);
86 call symputx('ALLOW_RESTORE',ALLOW_RESTORE);
87run;
88%mp_assert(
89 iftrue=(&syscc=0),
90 desc=Checking successful execution
91)
92%mp_assert(
93 iftrue=(%mf_nobs(work.jsparams)=1),
94 desc=Checking data was returned
95)
96%mp_assert(
97 iftrue=(&ALLOW_RESTORE=NO),
98 desc=Checking admin user cannot restore - as table was not approved
99)