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



I am guessing but one part of the equation is an unsigned integer and minus
21. My guess is that it is seeing the unsigned integer and deciding the
output of the equation is an unsigned integer then converting it to a signed
integer but never gets that far.

I would either try making the Positive value as signed or try a
%Int(PositiveValue - 21).



On Mon, Sep 27, 2010 at 2:04 PM, Koester, Michael <mkoester@xxxxxxxxxxxxx>wrote:

I have a variable defined "3i 0", local to a subprocedure that I expect
could be any whole number value from -128 to +127, per my understanding
of a signed integer. When my subprocedure puts what I expect to be a
minus 18 into the field, I get the dreaded "MCH1216 - too small to hold
result" crash & burn.

I'm sure I can fix it instantly by defining packed numerics, but I need
to understand the rules.

D PositiveValue 3u 0
D NegativeValue 3i 0
/free
PositiveValue = 3;
NegativeValue = PositiveValue - 21;
[down in flames we go]
/end-free

What could be so tough about subtracting 3 from 21 and expecting -18?
Please set me straight here. It's an SQLRPGLE program on a 6.1 box.

Many thanks.
Michael Koester

--
This is the RPG programming on the IBM i / System i (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 thread ...

Replies:

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.