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



One more thing on this:

Where you now see:
divisor = 10 ** daReceiver.nbrdec ;
rtnVal = packed31 / divisor ;

I used to have:
Rtnval = packed31 / (10 ** daReceiver.nbrdec) ;

(and I didn't have variable 'divisor.')

But the result when tested with a value of 123456789.123456789 was
123456789.123456788. This was at V5R3, and was resolved by the code you now
see. There are other ways, I think, to force RPG to handle the precision
more appropriately (search the archives if interested), but none quite as
clear (to me).

So if you decide to optimize / reduce code lines: beware.

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
Live and learn.
(But not in that order.)


Thanks. You'll want to enhance it with safety checks (like making sure
that num31/packed31 is long enough... and that the %SUBST() doesn't
overrun in either direction ... yada yada). But that should get you
moving in the right direction.

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"A government which robs Peter to pay Paul can always depend on the
support of Paul."
-- George Bernard Shaw



Just figured that out and the procedure worked great. I was already
piecing together similar code based Vern's comments when I was pulled
off task to work on a more pressing matter. Decided to check the
group before I got back to it, and I am glad I did. :)

Thanks again.


On Mon, Apr 23, 2012 at 5:12 PM, Dennis Lovelady
<iseries@xxxxxxxxxxxx>wrote:

Well, I have a ways to go before perfection sets in, too! :) I
saw
perfection on the street and it wouldn't even acknowledge me.

To that point: the last line in the example code I sent, is
incorrect.
It is the End of a Procedure, not the Beginning. So please change
the
B to E on that line. (Everything else, by the way, has been
tested.)

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"As long as we are lucky we attribute it to our smartness; our bad
luck we give the gods credit for."
-- Josh Billings


Thanks for the example. And to your point, I was looking at the
returned data in hex mode when I realized what had been returned
and
wrote the email, so I guess that is why I had hex on the brain.
I
realized after I sent it that I wasn't technically accurate, but
I
figured everyone would get what I meant. Almost sent a follow up
but decided against it.

Since everyone seemed to follow, I suppose my less than perfect
wording was adequate but not accurate. :-)

Thanks again for the example.


On Mon, Apr 23, 2012 at 3:31 PM, Dennis Lovelady
<iseries@xxxxxxxxxxxx>wrote:

Just remember, the character data here does not contain
'20.345'.
If it did, it would be easy. The data here is in hex and I
need
to get it to packed.

To quote Tom Hanks: I don't even want to think about what
they're not teaching you in school! Hex, in this context, is a
human's view of the data. Packed has to do with the way the
data is stored. Their usage is not interchangeable, and
neither
is in/compatible with the other.

What you've said is equivalent to "I wanted to send data to by
friend but all he received was ones and zeroes."

At any rate, the code found here will, I believe, do exactly
what you
want.
http://code.midrange.com/83a6933d01.html

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"Too bad all the people who know how to run the country are
busy
driving taxis and cutting hair."
-- George Burns

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


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



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.