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



As to the full range of an integer? A 4-digit B can have at most 9 digits. To get the upper end of an integer you have to go to a 10B 0, and that's an 8-byte integer (BIGINT in SQL)

You CAN put (outside of RPG) a 10-digit number into a 9B 0 - RPG probably won't like it, though.

Just speculating here - I don't need any harsh correction - I admit I'm not sure!!

Vern

On 3/18/2011 12:46 PM, Charles Wilt wrote:
Barbara....

I wouldn't normally question you but... :)

"The RPG and DDS B type is actually a decimal type"

I realized that the DDS B type allows one to specify a decimal
position of other than 0 (though I've never seen it used that way ;).

However, doesn't the DDS binary type (when decimal position = 0 )
support the full range of values that RPGLE integer would? Unlike
RPG's binary type?

Thus I've always considered DDS binary fields to be integers.

Am I lying to myself? Is there something DDS binary fields don't have
that true integer fields would?

Charles


On Fri, Mar 18, 2011 at 12:43 PM, Barbara Morris<bmorris@xxxxxxxxxx> wrote:
On 3/18/2011 11:52 AM, Vern Hamberg wrote:
Isn't a B (binary) type defined as 2 or 4 or 8? The number of bytes? Not
the number of digits? I'd recommend 5i 0. That's what the Data Type
Compatibility chart says in the Run-Time Library Reference. Both int and
long int are 10i 0.

The RPG and DDS B type is actually a decimal type, with decimal
positions. It's just stored as a binary. In RPG, it gets converted back
and forth to packed before it is used. So you can define a B-binary as 2
digits with 1 decimal place or 8 digits with 3 decimal places etc.

5B uses a 4-byte binary for storage, so for sure it isn't a match for a
short integer.

I think the 2B used in the SQL examples was probably a misunderstanding
probably caused by translating from the RPG III from-and-to positions
1-2B. It works ok though, and I think you could even get away with 1B
for the SQL indicator since anything from 1 to 4 digits means two bytes.
I agree that 5i makes the most sense.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



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.