Scott,
The data is in a character field in the format 12345.6789 with the decimal point
included.
I have another file that contains the number of digits and decimal places for
the field.
I need to get this into a numeric field for processing.
Since the %DEC bif required that the length and decimal values be known at
compile time, I am looking for an alternate method.
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: Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx>
To: RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
Sent: Wed, March 2, 2011 2:35:07 PM
Subject: Re: Convert Character to Numeric
It's unclear from your description how the data is stored in the
character field. The values you specify on %DEC() are not for reading
it's input, they are for controlling the *output* of the %DEC() BIF.
Since you said you're moving to a fixed-length numeric field, you should
be just fine with literals/constants for %DEC().
If the data in the char field isn't actually text data, but is already
in numeric format (such as raw packed, zoned data or integer data) then
you can use the LBCPYNV MI built-in to do the conversion. (%DEC
wouldn't be useful in that case, since it expects the input to be text.)
On 3/2/2011 12:48 PM, Jeff Young wrote:
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?
As an Amazon Associate we earn from qualifying purchases.