|
Yes, it is difficult to return 13 digits with a 10-position return value. :) If you have the RPG xTools you could use this: NumberFld = NumtoNum(%Subst(data: FldOffset: 7) : T_Packed : FldLen : 0) Another thing you want to watch out for, is if your data contains an embedded X'00' for example, if you had this: 0435065 209100F The value would end after the 2403951 value because of the X'00' that follows the X'51'. That's what strings do. -Bob -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Rich Dotson Sent: Friday, July 23, 2004 1:14 PM To: rpg400-l@xxxxxxxxxxxx Subject: Problem with the QXXPTOI API I am using the QXXPTOI API to convert a packed number in a character field to an integer. I have it defined as: D PackedToInt pr 10i 0 extproc('QXXPTOI') D PTR * value options(*string) D Digits 10i 0 value D Fraction 10i 0 value This procedure works correctly for all my packed fields except one. The field is defined in the file as 13P 0. The hex value for the field in error is: 0435065 209140F The returned value is -123063971 when it should be 240,395,104,605. The RPG code being executed is: NumberFld = PackedToInt(DataPtr+FldOffset:FldLen:0); FldOffset=363 which is the place in the data record and FldLen = 7 I'm assuming that since the number is so large I should be using the QXXPTOD API. If so, does anyone have a prototype definition for that API. I can't seem to get it setup correctly. Thanks, Rich Dotson RT3 Consulting Services, Inc. P.O. Box 126 Lorain, OH 44052-0126 eMail: Rich_Dotson@xxxxxxxxxxx _________________________________________________________________ Overwhelmed by debt? Find out how to 'Dig Yourself Out of Debt' from MSN Money. http://special.msn.com/money/0407debt.armx -- This is the RPG programming on the AS400 / iSeries (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 mailing list archive is Copyright 1997-2025 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.