× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Tommy:

<snip>
not too bad of a chore
dvalue s 20a Inz(' - 1A 2A 3A ')
dnumber s 10s 0
/free
number = %Dec(%XLate('A':' ':value):10:0);
*inlr=*on;
return;
</snip>

Easy for one "invalid" character, but my example was rather simple. If your value is '1Avvx%994' and you want 1994, you can do the following:

d validchars c ' 1234567890'
d c s 3i 0 inz
d value s 20a inz varying
d newvalue s 20s 0 inz varying

c = %check( validchars : value );
dow c > *zeros;
%subst( value : c : 1 ) = *blanks;
c = %check( validchars : value : c );
enddo;

monitor;
newvalue = %dec( value : 20 : 0 );
on-error;
// whatever seems appropriate (can't imagine what would be left besides numerics/blanks)
endmon;

Of course, this assumes no leading/trailing sign and no decimal points, but...in my example, credit card numbers shouldn't have them anyway. YMMV,
--Bruce Guetzkow



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.