From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Scott Klement
Sent: Monday, August 04, 2008 6:05 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: MOVEL in freeform
D cvtZonedToInt pr 10i 0 extproc('QXXZTOI')
d cvtZone * value options(*string)
d cvtDigits 10i 0 value
d cvtFraction 10i 0 value
You should remove 'options(*string)' from the first parameter. The
input isn't a string, it's a zoned decimal number.
I have no idea why you'd want to use this for your purposes, though. Is
your goal really to convert zoned decimal to integer? And if it is,
why use a C function? Why not use %int()?
AFIAK, your issue is thast you have bytes in zoned decimal format, but
they've been stored (for some weird unknown reason) in an alphanumeric
field instead of in a zoned decimal field.
The solution to that is to use overlaid fields in a data structure.
Though, you can solve the same problem by passing a mismatched parameter
(which is what you've done by calling QXXZTOI) or by pointer logic.
But, an overlaid data structure field would perform a lot better than
calling this API, and it'd also make a lot more sense to the next guy
reading your program.