× 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 to Buck and Scott, I wasn't reading the API docs correctly.

Also, I've known about the "b" vs. "i" data type issue for a while and I
should have known better... just goes to show that on Friday's my brain
power is severly diminished...

:-)

Joel
http://www.rpgnext.com

On Fri, 2003-10-17 at 23:41, Scott Klement wrote:
> Hi Joel,
> 
> The BINARY(4) specified in the API manuals is referring to a 4-byte binary
> integer.  Emphasis should go on the word "byte."
> 
> "4b 0" in RPG is a 4-digit binary integer.  Emphasis should be on the word
> "digit."   4b0 is only 2 bytes long.
> 
> So... first of all, your parameter list is wrong.  the "4b 0" should be
> either be "9b 0" or (better) "10I 0".    Also, the data structure needs to
> be changed to "10I 0" in place of every "4B 0."
> 
> Furthermore, the "B" data type is limited.   It does work as a binary
> data type, but it truncates numbers to decimal digits, instead of to
> binary digits (i.e. bits.)   Therefore, a 9B 0 maxes out at 999999999
> whereas a 10I 0 (which is true binary) can do 2147483647 as it's highest
> value.
> 
> The "10I 0" also performs better (because "B" converts to packed for any
> arithmetic, whereas true binary math can be done on "I")
> 
> Therefore, I recommend that you always use the "I" or "U" data types, and
> never use the "B" data type.  But, "B" WILL work, as long as you specify
> one that's actually 4 bytes rather than 4 digits :)
> 
> This is a FAQ.  (In fact, it could be the most commonly asked question on
> this list) please see the Midrange FAQ for more details:
> 
> http://faq.midrange.com/data/cache/24.html
> 
> Hope that helps
> 
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (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.