17create table work.example1(
18 TX_FROM
float format=datetime19.,
21 DD_SHORTDESC
char(256),
22 constraint pk primary key(tx_from, dd_type,dd_source),
23 constraint unq unique(tx_from, dd_type),
24 constraint nnn not
null(DD_SHORTDESC)
26%mp_getpk(work,ds=example1,outds=test1)
30 call symputx(
'test1',pk_fields);
34 iftrue=(
"&test1"=
"TX_FROM DD_TYPE DD_SOURCE"),
35 desc=mp_getpk gets regular PK values in correct order,
36 outds=work.test_results
41create table work.example2(
42 TX_FROM
float format=datetime19.,
45 DD_SHORTDESC
char(256),
46 constraint unq1 unique(tx_from, dd_type),
47 constraint unq2 unique(tx_from, dd_type, dd_source),
48 constraint nnn not null(tx_from),
49 constraint nnnn not null(dd_type)
51%mp_getpk(work,ds=example2,outds=test2)
55 call symputx('test2',pk_fields);
59 iftrue=("&test2"="TX_FROM DD_TYPE"),
60 desc=mp_getpk gets unique constraint with NOT NULL in correct order
65create table work.example3(
66 TX_FROM
float format=datetime19.,
69 DD_SHORTDESC
char(256),
70 constraint unq1 unique(tx_from, dd_type),
71 constraint unq2 unique(tx_from, dd_type, dd_source),
72 constraint nnn not null(tx_from)
74%mp_getpk(work,ds=example3,outds=test3)
78 call symputx('test3',pk_fields);
82 iftrue=("&test3 "=" "),
83 desc=mp_getpk does not capture unique constraint without NOT NULL,
84 outds=work.test_results
88%mp_getpk(work,outds=test4)
90%mp_assertdsobs(work.test4,test=ATLEAST 2)
94create table work.example5(
95 TX_FROM
float format=datetime19.,
98 DD_SHORTDESC
char(256)
100proc datasets lib=work noprint;
102 index create tx_from /nomiss unique;
104%mp_getpk(work,ds=example5,outds=test5)
107 call symputx('test5',pk_fields);
110 iftrue=("&test5"="TX_FROM"),
111 desc=mp_getpk captures single column not null unique index,
112 outds=work.test_results
117create table work.example6(
118 TX_FROM
float format=datetime19.,
120 DD_SOURCE
char(2048),
121 DD_SHORTDESC
char(256)
123proc datasets lib=work noprint;
125 index create pk_6=(tx_from dd_type) /nomiss unique;
127%mp_getpk(work,ds=example6,outds=test6)
130 call symputx('test6',pk_fields);
133 iftrue=("&test6"="TX_FROM DD_TYPE"),
134 desc=mp_getpk captures multiple column not null unique index,
135 outds=work.test_results