18create table work.maxkeytable(
19 keytable varchar(41) label=
'Base table in libref.dataset format',
20 keycolumn
char(32) format=$32.
21 label=
'The Retained key field containing the key values.',
23 'Integer representing current max RK or SK value in the KEYTABLE',
24 processed_dttm num format=E8601DT26.6
25 label=
'Datetime this value was last updated',
26 constraint pk_mpe_maxkeyvalues
27 primary key(keytable));
29create table work.locktable(
32 lock_status_cd
char(10) not
null,
33 lock_user_nm
char(100) not
null ,
36 lock_start_dttm num format=E8601DT26.6,
37 lock_end_dttm num format=E8601DT26.6,
38 constraint pk_mp_lockanytable primary key(lock_lib,lock_ds));
47 if mod(_n_,2)=0 then name=cats(
'New',_n_);
58 ,append_dsn=APPENDTABLE
69 desc=Checking errors in test 1,
70 outds=work.test_results
74 do val=1,3,5,20,21,22;
78%mp_assertcolvals(work.append.rk_col,
79 checkvals=work.check.val,
80 desc=All values have a match,
90data work.appendtable2;
99%mp_retainedkey(base_dsn=targetds2
100 ,append_dsn=APPENDTABLE2
103 ,check_uniqueness=YES
104 ,maxkeytable=x.maxkeytable
105 ,locktable=work.locktable
111 desc=Checking errors in test 2,
112 outds=work.test_results
115 iftrue=(%mf_nobs(work.append2)=21),
116 desc=Checking append records created,
117 outds=work.test_results
123 rk_col=_n_+209100000000;
126data work.appendtable3;
128 if mod(_n_,2)=0 then name=cats('New',_n_);
132%mp_assertscope(SNAPSHOT)
138 ,append_dsn=APPENDTABLE3
148%mp_assertscope(COMPARE,
149 desc=Checking macro scope leakage in mp_retainedkey (test 3)
154 desc=Checking errors in test 3 (large numeric RK),
155 outds=work.test_results
159 do val=209100000001,209100000003,209100000005,
160 209100000020,209100000021,209100000022;
164%mp_assertcolvals(work.append3.rk_col,
165 checkvals=work.check3.val,
166 desc=All large numeric values have a match,