I did a little test with the %int function, and apparently it can handle up
to a 20i 0. However, it can't handle a 20u 0 (unsigned integer).
D SmInt 5u 0
D Int 10u 0
D BigInt 20u 0
D
/free
SmInt=*Hival;
Int=*HiVal;
BigInt=*HIval;
Smint=%int(Smint);
Int=%int(Int);
BigInt=%int(BigInt); //**** Failed on receiver too small. BigInt
as 20i 0 works.
From: "Birgitta Hauser" <Hauser@xxxxxxxxxxxxxxx>
To: "'RPG programming on the IBM i \(AS/400 and iSeries\)'"
<rpg400-l@xxxxxxxxxxxx>
Date: 07/12/2013 12:59 AM
Subject: AW: Split Number into whole and fractional parts
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
Just for information: DB2 supports 3 types of integers:
1. SMALLINT (RPG equivalent is 5I 0) - Valid range -32768 - + 32767
2. INTEGER/INT (RPG equivalent 10I 0) - Valid range -2.1 Billion - + 2.1
Billion
3. BIGINT (RPG equivalent 20I 0) - Valid range -9,223,372,036,854,775,808
(Scotts Number) - +9,223,372,036,854,775,807
Even DDS supports real integers, but those digits are defined as 4B 0
(=SmallInt), 9B 0 (=Integer), 18B 0 (BigInt)
If a table or physical file that contains Integers with native I/O. The
integer values are converted into 4P 0, 9P 0 or 18P 0 as long as the
EXTBININT(*YES) keyword is not specified within the H-specs.
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
Im
Auftrag von Scott Klement
Gesendet: Thursday, 11.7 2013 22:51
An: RPG programming on the IBM i (AS/400 and iSeries)
Betreff: Re: Split Number into whole and fractional parts
Gary... that link is to the root of the Information Center, so it'd be hard
to tell which specific piece of info you're referring to from that link.
But, DB2 integers should allow values from -2147483648 to 2147483647.
So, it will allows 10-digit numbers as long as they are less than or
equal to 2147483647. If it really only allows 9-digit numbers, it's
not a true integer!
But, having said that, this thread is about RPG not DB2. RPG supports
64-bit integers, so the %INT BIF should handle numbers as large as
9223372036854775808. (Try to memorize that, haha) So that's most 19-digit
numbers, and all 18-digit numbers that it will handle.
Using %DEC() of course lets yo handle up to 63 digits, but how often does
that come up?
On 7/11/2013 2:02 PM, Gary Thompson wrote:
This link:
http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/index.jsp
seems to say DB2 integers are 0 to 9 digits
--
This is the RPG programming on the IBM i (AS/400 and 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.
--
This is the RPG programming on the IBM i (AS/400 and 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.