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


  • Subject: Re: A Packed-Decimal Machine? (was Entry Parameters)
  • From: Jon.Paris@xxxxxxxxxx
  • Date: Fri, 21 Jan 2000 15:08:18 -0500



 >> You've gotta be joking me!

Nope - that's pretty much it.  Forget parameters and just take simple case of a
field stored in a DS as type B.  Note I'm using "type" because I and U are also
binary.

To multiply your field by another (assume packed) the compiler will generate:

Move field to packed temp
Multiply temp by second value
Move packed result to binary field.

This does not happen for types I and U.

Basic reason is that a B type is defined as having a specific number of digits.
For example a 4 digit B field will occupy 2 bytes.  But 2 bytes can accommodate
values up to 32K - well beyond the 9,999 capacity of a 4 digit field.  The
conversion to packed ensures that only 4 digits are passed into the calculation
and only four digits come out.  When you use types I and U the compiler assumes
you know what you are doing and don't need the safety blanket.  For the same
reasons you should always use I or U when an API specifies a field as binary
otherwise there is the possibility you will incur truncation.



+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.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.