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



Scott (and Jerry)

Another example of this kind of thing is if you try the following 2 lines of
code (assuming String is a 10-byte character variable):

String = *all'A';
String = 'B' + *all'A';


The first line is fine and would fill the String variable with 'AAAAAAAAAA'.
However, the program won't compile if you include the second line - in this
case, you'll get RNF7421 and RNF7416 errors (non-compatible operands). You'd
think that it should give you 'BAAAAAAAAA'....

Pesky intermediate operands :-)

Rory (http://www.linkedin.com/in/roryhewitt)


On 1/22/07, Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx> wrote:

Hi Jerry,

> So I'm thinking (always dangerous), "Oh, *Zeros is a character field."
> But, then, I remembered another line in this same program (and similar
> lines in tons of other programs:
> w#ladj = *Zeros;

Hmmm...When I think of *Zeros, I don't think of it as being the same thing
as the number 0.

You see, *Zeros is neither character nor numeric.  *Zeros is a special
value that tells the computer to fill the entire field (no matter what the
data type) to zeroes. The compiler may generate different code,
depending on the data type.

What sort of code would it generate when it's only one of many operands in
an expression?  That's where it gets murky.  There's no field to set to
all zeroes, is there? It's an expression, not a simple assignment where
there's a particular field to set.

You have this:

   w#ladj = *Zeros - dlsqty * dlstks;

I know it means "fill the whole field with zeroes" but there isn't really
a field for it to fill!  I suppose it might fill the intermediate result
with zeroes before moving on to the next step...  But, I don't find it
intuitive.

Anyway...  I don't have a solution (other than using 0 in place of
*Zeroes, which you've already done) but I thought you might find this
perspective interesting.

--
Scott Klement http://www.scottklement.com

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.