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


  • Subject: Binary vs. Integer Parameters
  • From: bvining@xxxxxxxxxxxx
  • Date: Wed, 18 Nov 98 12:02:30 CST

Bill,

>From the System API Reference, Programming Tips for Binary Data, in
chapter 2:

"In the API parameter tables in this book, BINARY(2) and BINARY(4)
 represent numeric data.  These parameters must be signed, 2- or 4-byte
 numeric values with a precision of 15 (halfword) or 31 (fullword)
 bits and one high-order bit for the sign..."

so BINARY in the sense of system APIs refers not to RPGs definition of
binary (B) but rather a generic, but explicit, definition.  RPGs integer
(I) datatype matches this definition of BINARY; RPGs binary (B) does
not.  To answer your secondary question, yes -- APIs can, and do, return
data that overflows the RPG binary definition.

The QSYSINC QRPGLESRC includes currently continue to use binary (B) as
integer (I) was not supported back in some V3 releases (I believe they
were introduced in V3R6).  Due to all the wonderful enhancements to ILE
RPG over the last several releases I think it would be nice to update
the RPG QSYSINC includes though that would probably require using a new
source file as incompatible changes would occur if the current ILE RPG
source was simply replaced by more current techniques (Integers, Based
structures rather than storage allocating structures, etc.).

Bruce Vining

>
>John,
>
>> . . . So, if you define it as being a 4B field, then if the API (or
>whatever) returns
>> a value larger than 9,999 it would be truncated with unpredictable results.
>> If you define the field as 5I however, there is no truncation possible. . .
>>
>
>Okay, makes sense, so why then are the parameters for the API's defined
>binary?  And
>the follow up question, since the API parameters are defined as binary, isn't
>the
>quantity/value limitation therein inheirant (or would it be possible that even
>though
>the API's specify binary, they may pass back information that would overflow a
>binary
>field, but not an integer)?
>
>Bill
>

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.