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



Yes, of course, you are correct. This headache really has me off my game
today.

Brian May
Project Lead
Management Information Systems
Garan, Incorporated
Starkville, Mississippi



"Schutte, Michael D" <Michael_Schutte@xxxxxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
03/24/2011 10:01 AM
Please respond to
RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>


To
RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
cc

Subject
RE: Help with %Dec






Shouldn't you do new_value = %Dec(char:11:0)/10000 instead? It appears
that the string is 11 characters long. If a value of 12345678901 is
ever present in the string, then the BIF would fail because it's trying to
put a value to large through the BIF.


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of BMay@xxxxxxxxx
Sent: Thursday, March 24, 2011 10:40 AM
To: RPG programming on the IBM i / System i
Subject: Re: Help with %Dec

%DEC does not do what you think it does. It simply converts whatever is
in your character field to a numeric. The decimal must also be present in
the character field, it will not insert one for you. The second and third
parameters simply control the precision of the output. So they should be
set to the definition of your "new_value" field. In order to get the
output you want, you will need to do this:

new_value = %dec(char : 11 : 4)/10000 ;

Brian May
Project Lead
Management Information Systems
Garan, Incorporated
Starkville, Mississippi



Jeff Young <cooljeff913@xxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
03/24/2011 09:33 AM
Please respond to
RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>


To
rpg400-l@xxxxxxxxxxxx
cc

Subject
Help with %Dec






Given an 11 char field with the value of '00000639000', I am attempting to
use
%Dec to convert it to an 11.4 position numeric field.
new_value = %dec(char : 11 : 4).
I *want* the result to be 63.9000, but am getting 639000.0000 as
my result.
What am I not understanding about how this works, and what would be the
best way
to get the desired result.

TIA,

Jeff Young
Sr. Programmer Analyst
IBM -e(logo) server Certified Systems Exper - iSeries Technical Solutions
V5R2
IBM Certified Specialist- e(logo) server i5Series Technical Solutions
Designer V5R3
IBM Certified Specialist- e(logo)server i5Series Technical
Solutions Implementer V5R3
--
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.


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

________________________________

Notice from Bob Evans Farms, Inc: This e-mail message, including any
attachments, may contain confidential information that is intended only
for the person or entity to which it is addressed. Any unauthorized
review, use, disclosure or distribution is strictly prohibited. If you are
not the intended recipient, please contact the sender by reply e-mail and
destroy all copies of the original message and any attachments.

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.