|
Joe, Think of it this way: Defining a variable by number of bytes is a very computer oriented way of thinking. The limits for integer variables are strange from a human point of view (excluding nerds like us for a moment). Defining a variable by number of digits is a very human oriented way of thinking. The resulting storage is messy from a computer point of view. We may think of RPG as a programming language, but originally it was more like a tool. Some of its heritage still shows. Joep Beckeringh BTW: I am so glad that the first element of an array actually has number 1 in RPG! > -----Oorspronkelijk bericht----- > Van: rpg400-l-admin@midrange.com > [mailto:rpg400-l-admin@midrange.com] Namens Joe Pluta > Verzonden: dinsdag 17 september 2002 18:26 > Aan: rpg400-l@midrange.com > Onderwerp: RE: Problem Found! Need solution > > > > From: Joe Pluta > > > > What I asked was why a 4B field is the same size as a 5I field, > > but not the > > same size as a 5B field, which is even more confusing than the > > 4B/BINARY(4) > > mismatch. You've alluded to the fact that it has to do with decimal > > precision. A 5I field can hold any decimal representation > of a two-byte > > binary field, which can in turn hold any four-digit decimal > number (4B). > > A little further thought on the subject yields the following: > > B fields can have any precision, because they are used to > represent actual > application data, just ilke packed or zoned fields. The size > of a type B > field is the MINIMUM size of a binary field required to hold > a value of that > precision. Thus, a 4B field can be held in two bytes, while > a 5B field > requires four bytes. > > The I/U fields, on the other hand, are used specifically to > define a binary > field. You specify the minimum number of digits required to > hold all the > possible values for a binary field of a given size. That's > why I/U fields > can only be specified for 3, 5, 10 or 20 digits, > corresponding with 1, 2, 4 > and 8 byte binary fields. > > At least that's my read on the situation, and I'm stickin' to > it <grin>. > > Joe
As an Amazon Associate we earn from qualifying purchases.
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.