× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thanks for that clear explanation Jon.

Heh heh. . . "BEST thing"/"WORST thing" . . . . and thanks for the chuckle.

John

<snip>
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Jon Paris
Sent: Wednesday, October 27, 2021 12:28 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: %char and an identity column, as in binary

It isn't difficult if you understand what BinDec is all about. It is an effectively deprecated data type that due to the need to maintain compatibility still exists.

But to answer your question directly.

When a four byte binary is represented as type B(inDec) in RPG it is defined as having a length of 9 digits. Before any processing is performed on it, it is copied to a packed temporary of length 9. But an int(10) can contain values up to 2,147,483,647 and that won't fit - so you get the overflow exception you were seeing whenever the value in the field exceeds 999,999,999.

This is why EXTBININT(*Yes) cures the problem. It says to treat integers as real integers and not the stupid legacy B(indec) type. Older releases of RPG could not offer this option as B(indec) was the only "binary" format supported.

It is all part of the blessing/curse of IBM i. The BEST thing about the platform is I can compile and run 30+ year old code without changing a thing. The WORST thing about the platform is I can compile and run 30+ year old code without changing a thing.


Jon Paris
</snip>

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.