When I want an integer in an RPGLE program, what data type should I choose? I'm talking about an integer that doesn't correspond to any field in the database, just a normal general purpose integer - kind of the equivalent of an int
in Java.
views:
236answers:
2
A:
You can use the binary (signed integer) (B) or integer (unsigned integer) (I) types. You can specify the size with the digit values of 3 (1 byte), 5 (2 bytes), 10 (4 bytes) or 20 (8 bytes). The equivalent of a Java int would be 10B.
Paul Morgan
2009-06-19 16:57:31
+2
A:
Here's a chart from the ILE RPG Programmer's reference guide:
byte - 3I 0 (1-byte integer)
short- 5I 0 (2-byte integer)
int - 10I 0 (4-byte integer)
long - 20I 0 (8-byte integer)
I use the 10I 0 form of integer most often. You'll find it's used in most of your API calls as well.
Tracy Probst
2009-06-23 13:52:39