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



And casting *LOVAL or *HIVAL to a more meaningfull value is nonsense as
well, these values have the meaning of "something very high" or
"something very low" and making calculations is meaningless. Adding 1 to
*Loval is comparable to adding 1 to negative infinity: the outcome is
not usable since infinity is... well as the word suggests infinite,
never ending, not having a fixed value (otherwise the concept of
infinite has to be revised and the laws of physics will change beyond
recognition).

The question is: What would be gained by allowing calculations with
special values like *LOVAL and *HIVAL?

Cor

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Reeve
Sent: vrijdag 17 augustus 2007 9:08
To: RPG programming on the AS400 / iSeries
Subject: Re: *LOVAL in arithmetic expression

Eric, you made my point. If *LOVAL "depends upon the data-type it's
being assigned to..." the compiler should know, based upon the
properties of the result field, what's being requested and therefore how
it should be presented. But a better example is *HIVAL: if I use *HIVAL
to populate a 5p0 field, I get 99999. If I use *HIVAL to populate a 5a
field, I get x'FFFFFFFF'.

The ILE RPG compiler casts ("temporarily converts") *HIVAL correctly,
into numeric or alpha, in both cases. It seems to me that the compiler,
when evaluating an arithmetic expression, should be able to handle
*LOVAL (as negative 9's) and *HIVAL (as positive 9's) either in
assignments or in expressions.

Here's what the V5R4 manual (page 126) says:
"Figurative constants can be specified in factor 1 and factor 2 of the
calculation specifications."

There's no mention of the use of figurative constants in expressions.
"Cast" doesn't even show up in the V5R4 ILE manual, even though there's
often (automatic) casting going on when RPG and Java talk.

Casting is a key concept of modern programming languages like C# and
Java.
Boxing and unboxing, more sophisticated forms of casting, provide the
ability to treat value types (like integers, which live on the stack) as
reference types (i.e. objects, which live in heap storage). C# handles
boxing automatically but Java requires wrapper types like Integer and
Float.
If ILE RPG can't figure out how to handle *HIVAL and *LOVAL in
expressions, I'll be disappointed. But we can't get free-form "F", "D",
or "O" specs either!

-rf


On 8/16/07, DeLong, Eric <EDeLong@xxxxxxxxxxxxxxx> wrote:

Reeve,

*LOVAL is a special value that depends on the data-type it is being
assigned to / compared with. In an expression, the compiler has no
idea what type to use, so it just fails.

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Reeve
Sent: Thursday, August 16, 2007 5:12 PM
To: RPG programming on the AS400 / iSeries
Subject: *LOVAL in arithmetic expression


You can do this-

AoRBN = *loval;
but not this:

AoRBN = (0 - *loval);

It looks like RPG doesn't understand casting or implicit conversions.

I know the workaround...

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




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


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



This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.


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.