|
Jeff,Something like the following.
So how about using a data structure to do the conversion for you?
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jeff Young
D nbrToMoveDS DS
D fixedLenNbr 20S 2
D fixedLenChar 20A overlay(fixedLenNbr:1)
D char18Value 18A overlay(fixedLenChar:1)
D char2Value 2A overlay(fixedLenChar:*NEXT)
fixedLenNbr = 0;
x = ( %scan('.':datafield:1) - 1 ); // Find decimal position
y = ( 18 - x) + 1;
%subst(char18Value:y:x) = %subst(datafield:1:x);
x = x + 2;
char2Value = %subst(datafield:x:2);
And fixedLenNbr should be 123.45.
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
Sent: Wednesday, March 02, 2011 11:14 AMthe
To: RPG programming on the IBM i / System i
Subject: Re: Convert Character to Numeric
The data is comming from a data file and is in the format 123.45 with
decimal point in the data.Solutions V5R2
Thanks,
Jeff Young
Sr. Programmer Analyst
IBM -e(logo) server Certified Systems Exper - iSeries Technical
IBM Certified Specialist- e(logo) server i5Series Technical Solutionsbe in the
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
archives. One is cvthc not converting all values. I deleted theother thread
from my folder so I can't get the topic for you right now.it's in a
How is the data you are receiving formatted? Signed, packed? I know
character field, I'm looking for the representation.[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On
Rick
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
Behalf Of Jeff Youngis stored
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
in a file.in my
I need to convert this to a fixed length numeric field that is defined
program.known at
It appears that the %Dec BIF required a literal or a value that is
compile time.
What is the best way to do this?
Thanks,
Jeff Young
Sr. Programmer Analyst
As an Amazon Associate we earn from qualifying purchases.
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.