17create table work.maxkeytable(
18 keytable varchar(41) label=
'Base table in libref.dataset format',
19 keycolumn
char(32) format=$32.
20 label=
'The Retained key field containing the key values.',
22 'Integer representing current max RK or SK value in the KEYTABLE',
23 processed_dttm num format=E8601DT26.6
24 label=
'Datetime this value was last updated',
25 constraint pk_mpe_maxkeyvalues
26 primary key(keytable));
28create table work.locktable(
31 lock_status_cd
char(10) not
null,
32 lock_user_nm
char(100) not
null ,
35 lock_start_dttm num format=E8601DT26.6,
36 lock_end_dttm num format=E8601DT26.6,
37 constraint pk_mp_lockanytable primary key(lock_lib,lock_ds));
46 if mod(_n_,2)=0 then name=cats(
'New',_n_);
57 ,append_dsn=APPENDTABLE
68 desc=Checking errors in test 1,
69 outds=work.test_results
73 do val=1,3,5,20,21,22;
77%mp_assertcolvals(work.append.rk_col,
78 checkvals=work.check.val,
79 desc=All values have a match,
89data work.appendtable2;
98%mp_retainedkey(base_dsn=targetds2
99 ,append_dsn=APPENDTABLE2
102 ,check_uniqueness=YES
103 ,maxkeytable=x.maxkeytable
104 ,locktable=work.locktable
110 desc=Checking errors in test 2,
111 outds=work.test_results
114 iftrue=(%mf_nobs(work.append2)=21),
115 desc=Checking append records created,
116 outds=work.test_results
122 rk_col=_n_+209100000000;
125data work.appendtable3;
127 if mod(_n_,2)=0 then name=cats('New',_n_);
131%mp_assertscope(SNAPSHOT)
137 ,append_dsn=APPENDTABLE3
147%mp_assertscope(COMPARE,
148 desc=Checking macro scope leakage in mp_retainedkey (test 3)
153 desc=Checking errors in test 3 (large numeric RK),
154 outds=work.test_results
158 do val=209100000001,209100000003,209100000005,
159 209100000020,209100000021,209100000022;
163%mp_assertcolvals(work.append3.rk_col,
164 checkvals=work.check3.val,
165 desc=All large numeric values have a match,