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



>But, here is another situation I have to know
>in order to use integers in my database that I
>should not have to.

Hrm?  I don't understand the angst I hear in your post.  The integer data
type does not exist in RPG III.  If converting an RPG III program to RPG IV
results in changed behaviour (loop counter used to truncate at 9999, now
doesn't) then that's a Bad Thing.  Do remember that BINARY fields can have
decimal positions and INTEGER fields cannot.  Anyway, RPG IV programs keep
the binary representation of SQL INTEGER fields for compatibility.  To use
them as integers, you apply extbinint.  A hasty scan through the RPG
Reference describes this behaviour clearly on V5R1 page 246.  Since this is
part of the RPG language and it's heritage, then yes, this is something that
you do in fact need to know.

>Here is a typical OS/400 data base data
>type not supported by RPG as a standard.

DDS does not support integer data type.  I can't personally imagine calling
integer a typical DB data type.  It's an SQL data type, and if I designed my
database using SQL, I might expect my developers to use SQL to get at it,
but if they chose RPG, then they should understand how to read that data.
This argument holds for LOBs as well.

>This really hurts RPG, just like being
>required to know the maximum digit length
>of integers.

Another head scratcher for me.  Must be my week.  How am I required to know
the maximum digit length of the integer data type?  What's worse, there is
no such limit.  There is a maximum (and minimum) value that can be stored.
Quoting from the V5R1 RPG Reference, page 184:

"The range of values allowed for an integer field
 depends on its length.
 Field length Range of Allowed Values
 3-digit integer -128 to 127
 5-digit integer -32768 to 32767
 10-digit integer -2147483648 to 2147483647
 20-digit integer -9223372036854775808 to 9223372036854775807"

So, thinking about integers as a certain number of digits will result in
your program breaking.  Even though a short is 5 digits, it cannot hold the
value 99999:

d smallint        s              5i 0
c                   eval      smallint = 99999
c                   seton                                        lr

This fails at runtime with an RNQ0103 'target too small' error.

The only reason I am posting is that there seems to be a fair amount of
confusion about numeric precision in the RPG world, in general.  I firmly
believe that many of the charges levelled against RPG are a result of not
reading about the new feature before using it.  Certainly this was the case
during the 'eval produces incorrect results' threads.  If anything really
hurts RPG, this would be it.  RPG IV is not the simple language that RPG II
was, and failure to read and understand concepts before implementing them is
clearly Not a Good Idea.

Respectfully,
  --buck


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.