|
That is not what I meant. I meant that
x - (-1) is really an addition. If x was 9999, then x - (-1) would be
10000 or 0000 if x had only 4 digits.
But ?Vernon? pointed out that if x was -9999 then x - 1 would be -10000
which would also pose a dilemma.
Rob Berendt
--
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety."
Benjamin Franklin
"Dare @ Work"
<oludare To: <rpg400-l@midrange.com>
Sent by: cc:
rpg400-l-admin@mi Fax to:
drange.com Subject: Re: Strange behavior
w/%editc()
02/26/2002 10:39
AM
Please respond to
rpg400-l
>(Negative minus a negative is an addition).
Do you mean Negative "multiply" by Negative is an addition?
----- Original Message -----
From: <rob@dekko.com>
To: <rpg400-l@midrange.com>
Sent: Tuesday, February 26, 2002 10:34 AM
Subject: RE: Strange behavior w/%editc()
>
> >This is part and parcel of the 'expression' rules for EVAL.
> Basically, 'fiscalYr - 1' is an expression. In order to hold all the
> possible digits of the resulting value, the compiler applies some rules
to
> create an 'intermediate' or 'work' variable. The %editc() is working
> against the work variable.
>
> I wondered about that. I should have tested that. Changing my program
> from:
> headdesc = 'Fixed Model FY ' + %editc(fiscalYr - 1:'X');
> dsply headdesc;
> headdesc = 'Fixed Model FY ' + %editc(year1 - 1:'X');
> dsply headdesc;
> headdesc = 'Fixed Model FY ' + %editc(year2 - 1:'X');
> dsply headdesc;
> headdesc = 'Fixed Model FY ' + %editc(year3 - 1:'X');
> dsply headdesc;
> to:
> headdesc = 'Fixed Model FY ' + %editc(fiscalYr:'X');
> dsply headdesc;
> headdesc = 'Fixed Model FY ' + %editc(year1:'X');
> dsply headdesc;
> headdesc = 'Fixed Model FY ' + %editc(year2:'X');
> dsply headdesc;
> headdesc = 'Fixed Model FY ' + %editc(year3:'X');
> dsply headdesc;
> changed the results from:
> DSPLY Fixed Model FY 02001
> DSPLY Fixed Model FY 02002
> DSPLY Fixed Model FY 02003
> DSPLY Fixed Model FY 002004
> to:
> DSPLY Fixed Model FY 2002
> DSPLY Fixed Model FY 2003
> DSPLY Fixed Model FY 2004
> DSPLY Fixed Model FY 02005
>
>
> It just baffles me as to why the compiler thought to add an extra digit
on
> a subtraction. Granted if it was a variable, and there was a possibility
> that the variable was negative, then it would make sense. (Negative
minus
> a negative is an addition. And if year was 9999 -(-1) would be 10000 or
> 0000 in 4 digits.) But that isn't the case here.
>
> Rob Berendt
> --
> "They that can give up essential liberty to obtain a little temporary
> safety deserve neither liberty nor safety."
> Benjamin Franklin
>
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
> To post a message email: RPG400-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
> or email: RPG400-L-request@midrange.com
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
>
_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
or email: RPG400-L-request@midrange.com
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-2025 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.