What should be my standard choice of integer type in RPGLE?

When I want an integer in an RPGLE program, which data type should I choose? I mean an integer that does not correspond to any field in the database, just a regular integer - a kind of int equivalent in Java.

+4
source share
2 answers

Here is a diagram 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 most often use the 10I 0 form of an integer. You will also find it in most of your API calls.

+8
source

You can use binary (signed integer) (B) or integer (unsigned integer) (I). You can specify the size with the numeric values ​​3 (1 byte), 5 (2 bytes), 10 (4 bytes) or 20 (8 bytes). The equivalent of Java int is 10B.

-2
source

Source: https://habr.com/ru/post/1286456/


All Articles