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



You might need to refine this somewhat:
X = -1009.78061 ;
IntPos = %len(%char(%int(%abs(x)))) ;

This will return 4. Below solution would have returned 5, including sign.

Also curious what value this would have in bidness programming. :)

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"History will be kind to me, for I intend to write it."
-- Churchill


How about something like:

x = 1009.78061;
IntPos = %len(%char(%int(x)));

This should set IntPos to 4, as you requested. Note that

%int() removes the decimal places, thus it turns 1009.78061 into
the numeric value 1009
%char() converts the numeric 1009 into a character string of '1009'
%len() measures the length of the character string.

Now that I've answered your question -- can you please explain why you
needed it? Now that you have the number of "integer positions", what
are you going to do with that? I can't think of what good it'd do
you...

On 9/9/2010 1:28 AM, Raja Nama wrote:
Dear All,



Let me explain through examples.



Let us say we have a variable WX of length 13,8.



If I have value 123.3567, I need no. of integer positions filled
that is 3.



If I have value 1009.78061, I need no. of integer positions filled
that
is 4.



Do we have any built in functions to do the same or simple logic will
do.



Regards

Reddy Raja Nama




--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.