oh... now you just make thing easy on us.
%dec will auto line up the decpos automatically for you.
so you can simply do this:
myDec = %dec(myCharValue :63 :30); //This will work for value of 123.45,
2.00000001, 1211313 or ....
You just need to watch out for numeric data overflow, where myDec is too
small to receive the result of %dec.
"Jeff Young" <cooljeff913@xxxxxxxxx> wrote in message
news:mailman.31937.1299095746.2702.rpg400-l@xxxxxxxxxxxx...
The data is comming from a data file and is in the format 123.45 with the
decimal point in the data.
Thanks,
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
________________________________
From: "Rick.Chevalier@xxxxxxxxxxxxxxx" <Rick.Chevalier@xxxxxxxxxxxxxxx>
To: rpg400-l@xxxxxxxxxxxx
Sent: Wed, March 2, 2011 2:04:07 PM
Subject: RE: Convert Character to Numeric
Jeff,
There are two recent threads that relate to this topic. They should be in
the
archives. One is cvthc not converting all values. I deleted the other thread
from my folder so I can't get the topic for you right now.
How is the data you are receiving formatted? Signed, packed? I know it's in
a
character field, I'm looking for the representation.
Rick
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On
Behalf Of Jeff Young
Sent: Wednesday, March 02, 2011 12:48 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Convert Character to Numeric
I have a character field where the number of digits and decimal places is
stored
in a file.
I need to convert this to a fixed length numeric field that is defined in my
program.
It appears that the %Dec BIF required a literal or a value that is known at
compile time.
What is the best way to do this?
Thanks,
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.
Privileged and Confidential. This e-mail, and any attachments there to, is
intended only for use by the addressee(s) named herein and may contain
privileged or confidential information. If you have received this e-mail in
error, please notify me immediately by a return e-mail and delete this
e-mail.
You are hereby notified that any dissemination, distribution or copying of
this
e-mail and/or any attachments thereto, is strictly prohibited.
As an Amazon Associate we earn from qualifying purchases.