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

I agree: the nature of the beast is a little murky. Usually I just use it to set a field's value to, well, zeros. Though I have, as illustrated (*Zeros ADD X Y) used it in place of, say, MOVE X Y in fixed-format code. Which the compiler likes just fine. My guess is that it is either EVAL that doesn't like it in this context (though EVAL w#ladj = *Zeros compiles just fine), or they (the compiler writers) grandfathered it into the ADD, SUB, etc., op-codes since I've used it in RPG II, III, and IV as illustrated by the ADD example.

I guess "murky" is as apt as "strange" in this case .-) .

        * Jerry C. Adams
*IBM System i5/iSeries Programmer/Analyst
B&W Wholesale Distributors, Inc.* *
voice
        615.995.7024
fax
        615.995.1201
email
        jerry@xxxxxxxxxxxxxxx <mailto:jerry@xxxxxxxxxxxxxxx>



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



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.