× 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.



On 2020-08-25 5:39 p.m., Bruce Vining wrote:
As I understand it, and Barbara can certainly jump in (hint, hint), there
were perfectly good rationalizations at the time for how the B datatype was
implemented. A pain today perhaps, but reasonable in years past.


I'll jump in, but I'm only guessing.

That weird B data type was invented before my time, for RPG II on the System 36 or even before that.

My understanding is that it was intended to save storage. A packed number with 9 digits takes 5 bytes and a binary number with 9 digits only takes 4 bytes. If I understand correctly, it wasn't just storage for files, it was also the static storage for program variables.

I think the implementation of the B type still makes sense if you actually want a decimal number that's just stored in binary form. If you want say a decimal(7,2) number stored in binary form for some reason. Or even if you want a decimal(9,0) number stored in binary form. For a decimal(7,2) number, you want it to have a range of -99999.99 to 99999.99. So I think the compiler's weird behaviour of copying to a packed(7,2) temporary to enforce the range makes sense.

What I -don't- know is why "they" didn't also have a true binary that supported the full range right from the start. DDS still doesn't have that ...


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.