Hello!
In a grid-field, I have to display numbers bigger than 2.147.483.647. The value is stored in database as B4. When I redefine to I4 (integer 4) I can not display values bigger than from -2.147.483.647 to 2.147.483.647. How is it possible to change this integer typ to 0 to 4.294.967.295 (signed/unsigned)?
Not possible, Natural does not have “unsigned” integer types.
You would have to circumvent this by calling an external routine and convert your B4 to
a data type allowing for values exceeding those of a signed I4.
You said you wanted to display bigger numbers. There is a feature in Natural that is rarely used. The result of a numeric computation can be stored in an alpha field, as shown below:
DEFINE DATA LOCAL
1 #BIN (B4) INIT <H’FFFFFFFF’>
1 #PACKED (P11)
1 #alpha (a20)
END-DEFINE
include aasetc
ASSIGN #PACKED = #BIN
IF #PACKED < 0
THEN
ASSIGN #PACKED = #PACKED + 4294967296
END-IF
DISPLAY #BIN#PACKED
compute #alpha = #packed + 1234567890
write // ‘=’ #alpha
END