|
Hans, That's all well and good, but... 1) Why is DDS limited to 2 and 4 byte binaries and seems to use the RPG-like declaration for them (or has that changed?) 2) Why would the timing of int->int copy be slower than Bin->Bin in RPG IV as was reported here earlier today? -Bob -------- Original Message -------- Subject: Re: int vs binary questions From: "Hans Boldt" <boldt@xxxxxxxxxx> Date: Mon, February 09, 2004 12:23 pm To: rpg400-l@xxxxxxxxxxxx Steve Richter wrote: > I have a 170 with 460 cpw. But that should not matter, all the results are > relative to the same system. Bin to bin is 15% faster than int to int. Add > to bin is off the charts, 20x slower than add to int. > > I would like to know if the rpg definition of "Binary" is unique to it and > if it predates the s/38. And was the as400 database handling of binary > something forced on it by RPG? > Time again for a history lesson, eh? Let's go back to RPG II, as implemented on machines like the S/34. RPG II only had zoned decimal numeric as the internal representation for numerics. (Externally, it supported a bunch of other formats, like packed and binary decimal, left/right signed, etc.) RPG III on the S/38 added binary decimal and packed decimal as internal numeric formats, and made them work exactly the same as zoned decimal. (Call all three the "decimal" formats.) It did this by implicitly converting binary and zoned values to packed before all arithmetic. As far as DDS is concerned, "binary" can hold 2, 4, or 8 byte two's complement values. RPG is the odd one out since it maps DDS's "B" format into RPG's "B" format. Clearly, that's not always the best match, and never was. RPG IV added (eventually) three other numeric formats: float, integer, and unsigned, each with its own unique set of characteristics. As is true with most CPU's, the iSeries implements arithmetic fastest in binary, and so RPG's integer and unsigned formats are the fastest for arithmetic. For compatibility, RPG IV had to continue to map the "B" format in DDS to RPG's "B" format. Thus, the EXTBININT keyword is needed to tell the compiler to break compatibility, and do the right thing instead. Cheers! Hans _______________________________________________ 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 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.