51%macro mp_validatecol(incol,rule,outcol);
55%let tempcol=%mf_getuniquename();
57%
if &rule=ISINT %then %
do;
59 if not missing(&incol) then
do;
60 &tempcol=input(&incol,?? best32.);
61 if not missing(&tempcol) then
if mod(&tempcol,1)=0 then &outcol=1;
65%
else %
if &rule=ISNUM %then %
do;
70 &tempcol=input(&incol,?? best32.);
71 if missing(&tempcol) then &outcol=0;
75%
else %
if &rule=ISLIB %then %
do;
78 &tempcol=prxparse(
'/^[_a-z]\w{0,7}$/i');
79 if missing(&tempcol) then
do;
80 putlog
'ERR' +(-1)
"OR: Invalid expression for ISLIB";
85 if prxmatch(&tempcol, trim(&incol)) then &outcol=1;
88%
else %
if &rule=ISNAME %then %
do;
92 &tempcol=prxparse(
'/^[_a-z]\w{0,31}$/i');
93 if missing(&tempcol) then
do;
94 putlog
'ERR' +(-1)
"OR: Invalid expression for ISNAME";
99 if prxmatch(&tempcol, trim(&incol)) then &outcol=1;
102%
else %
if &rule=LIBDS %then %
do;
106 &tempcol=prxparse(
'/^[_a-z]\w{0,7}\.[_a-z]\w{0,31}$/i');
107 if missing(&tempcol) then
do;
108 putlog
'ERR' +(-1)
"OR: Invalid expression for LIBDS";
113 if prxmatch(&tempcol, trim(&incol)) then &outcol=1;
116%
else %
if &rule=ISPATH %then %
do;
123 if length(trim(&incol))>0 and anycntrl(&incol)=0 then
do;
124 %
if "%upcase(&sysscp)"=
"WIN" or
"%upcase(&sysscp)"=
"DNTHOST" %then %
do;
126 if substr(&incol,2,1)=
':' and substr(&incol,3,1) in (
'\',
'/') then
129 if substr(&incol,1,2)=
'\\' and scan(&incol,2,
'\') ne '' then
133 if &outcol=1 then do;
134 if index(substr(&incol,3),
':')>0 then &outcol=0;
135 if index(&incol,
byte(34))>0 then &outcol=0;
136 if index(&incol,
'<')>0 then &outcol=0;
137 if index(&incol,
'>')>0 then &outcol=0;
138 if index(&incol,
'|')>0 then &outcol=0;
139 if index(&incol,
'?')>0 then &outcol=0;
140 if index(&incol,
'*')>0 then &outcol=0;
144 if substr(&incol,1,1)=
'/' then &outcol=1;
148%else %if &rule=FORMAT %then %do;
152 &tempcol=prxparse('/^(?:[_a-z\$]\w{0,31}|[0-9]+)\.[0-9]*$/i
');
153 if missing(&tempcol) then do;
154 putlog 'ERR
' +(-1) "OR: Invalid expression for FORMAT";
159 if prxmatch(&tempcol, trim(&incol)) then &outcol=1;