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



Charles

As you know, in DDS, you can have non-zero scale for the B type. It's not something that any other system has that I'm aware of. And it's rather strange to see this in STRSQL:

Field File Type Length Scale
BIN1 BINTYPESA SMALLINT 1
BIN2 BINTYPESA SMALLINT 3 1
BIN4 BINTYPESA SMALLINT 4
BIN5 BINTYPESA INTEGER 5
BIN9 BINTYPESA INTEGER 9
BIN10 BINTYPESA BIGINT 10

Scale > 0? On a SMALLINT? Crazy time!

In the Open Access data types, I see that this is why the decimal type includes packed, zoned, and binary. And there are separate integer types. Altogether there are 4 - decimal, integer, unsigned, and float.

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.