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



Bob wrote:
>This is what continues to confuse people in RPG.
>Some data types, like "I" are well known datatypes that are referred to
>in a specific way. For example an "Int 2" value, or an "Int 4" value.
>Also we hear "16-bit integer". We never hear "5-digit integer" when
>referring to these values.
>
>This was a problem with B ("binary") fields as well.
>
>To this day, I have to correct code that is 2i0 instead of 5i0. Why?
>Because 2i0 is correct in the minds of the programmer. In fact, "2i" is
>correct enough, but "2i0" is acceptable, as if 4i0, 8i0, and 1i0. Even
>someone who uses these values everyday of his life, I find myself
>wishing the way they were entered was "4i0" instead of 10i0.

Hindsight is always 20/20.  In retrospect, perhaps we should
have gone with number of bytes rather than digits.  Both had
their advantages and disadvantages, but at the time we felt
that consistency with the decimal types was more important.
Thus, you'd know that a 10I0 variable has a precision of 10
digits when used in conjunction with decimal values within
an expression.  Or when used with %EDITC and %EDITW.

The next release after we added integer and unsigned, we
added float numeric.  With float, it really didn't make
sense to declare them in terms of digits of precision, and so
4F and 8F were used.  If we knew we'd use those for float,
then would we have gone with 2I and 4I for the integers?
Perhaps.  Or perhaps not.  Float is still fundamentally
different from the other numeric types anyways.  It's a
numeric type, but there are places you can code numerics of
any type but not float.

>To solve this, I've created a /COPY that includes all these data type,
>and I've named them INT1, INT2, INT4, and INT8. And I've been using
>LIKE(INT4) in my code.  (Please tell me the LIKE'd fields are INT4 and
>not packed!)

I like this approach.  The use of LIKE and LIKEDS should be
strongly encouraged.


Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.com



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.