|
>From: PatrickConner@parkdalemills.com >Date: Tue, 25 Sep 2001 10:36:40 -0400 > >The other day I was discussing the differences/advantages of packed >numerics vs. zoned numerics in physical files. >This was brought up by the fact that zoned becomes packed during the >compile unless explicitly defined. >One of the benefits of packed is that it is supposed to perform better. >What other reasons are there for this? >Also, consider packed vs. binary. >I understand that if I define a binary field in a physical file the >compiler will convert it to packed. Is it true that the packed field is >then converted to binary to be processed at the MI level (or somewhere down >there) to be reconverted back to packed on the way back up? Patrick, RPG converts decimal types (zoned, packed, 'B'-binary) to/from packed when doing arithmetic on them. I don't know whether packed fields are then re-converted to binary as part of MI-level processing. So packed performs better than binary or zoned in an RPG program. RPG doesn't convert 'I'-integer (known as "binary" outside the RPG world) fields, unless it's doing calculations with other packed fields. You can get your zero-decimal-position binary fields from external files and data structures to be treated as integer (rather than 'B'-binary) types by coding EXTBININT(*YES) in your H spec. (For compatibility reasons, RPG IV has to keep the same bizarre rules for 'B'-binary as RPG III had. It's related to the truncation that happens if the actual value is larger than can fit in the specified number of digits. The high-value for a true binary number isn't a nice tidy number of 9's (214748364 vs 999999999).) Rule of thumb: define all zero-decimal position variables as integer or unsigned. Define all non-zero-decimal position variables as packed, for convenience (handling the decimal scaling yourself would be ugly, and probably slower, too). Barbara Morris
This mailing list archive is Copyright 1997-2026 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.