|
Scott,
I'm curious, if this function shouldn't be used the OP's purpose, then what should it be used for?
It seems to me that it's designed to convert from a zoned decimal value stored in a character buffer
to an integer. Is that not the case?
The OP had "00000000M" and needed to convert it to -4.
int QXXZTOI(unsigned char *zptr, int digits, int fraction);
Thanks!
Charles Wilt --
Software Engineer
CINTAS Corporation - IT 92B
513.701.1307
wiltc@xxxxxxxxxx
-----Original Message-----
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
Hi Alan,
D cvtZonedToInt pr 10i 0 extproc('QXXZTOI')You should remove 'options(*string)' from the first parameter. The
d cvtZone * value options(*string)
d cvtDigits 10i 0 value
d cvtFraction 10i 0 value
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.
This e-mail transmission contains information that is intended to be confidential and privileged. If you receive this e-mail and you are not a named addressee you are hereby notified that you are not authorized to read, print, retain, copy or disseminate this communication without the consent of the sender and that doing so is prohibited and may be unlawful. Please reply to the message immediately by informing the sender that the message was misdirected. After replying, please delete and otherwise erase it and any attachments from your computer system. Your assistance in correcting this error is appreciated.
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.