× 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.



"Ex: .153000 to print like .153.."

This is an expanded version of how I would do it. My "normal" tendency is to
wrap it all up into a single line (and that is doable) but I've been coming into thinking
that when you break out the steps explicitly it's easier maintenance for the next guy
(and that might be you)...

D nbr s 8p 6 inz(1.153000' D char s 12a D zero s 1p 0 inz(*Zero)
D xpsn s 5i 0

// Convert to edited number with trailing zeros... //
char = %editc(nbr:'P') ;
// Check backwards to find the last character *NE zero...
//
xpsn = %checkr(zero:char) ;


// If xpsn = *Zero, there are no trailing blanks, and we're done
// Otherwise, just convert it to the substring that ends at xpsn, which // will
"automatically" drop the trailing zeros
//
if idx > *zero ;
char = %subst(char:1:idx) ;
endif ;




tim wrote:
Give this a try:

D d s 8 6 inz(1.153) D da s 8 inz('1.153000')
/free da = %XLATE('0':' ': %editc(d:'O'): %CHECKR('0':%editc(d:'O'))) ;



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.