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



>Date: Mon, 14 Jan 2002 10:34:40 -0500
>From: "Mike Naughton" <mnaughton@juddwire.com>
>
>I'm trying to join the twentieth century here and replace all my MOVEs
>with EVALs, but this one has me stuck. If I have a 9-element array  RA and
>I want to fill the last three elements with, say, "X", I can code:
>
>MOVEA          *ALL('X')           RA(7)
>
>Is there a way I can do the same thing  using EVAL?

Here's one way:

C           for     i = 7 to %elem(RA)
C           eval    RA(i) = *all'X'
C           endfor

Here's another way that will probably perform somewhat better,
if the number of elements is very large (which it's not in
your case):

D data      s             65535a    based(pData)
D pData     s                  *
C           eval    pData = %addr(RA(7))
C           eval    numElems = %elem(RA) - 7 + 1
C           eval    %subst(data : 1 : %size(RA) * numElems)
C                       = *ALL'X'

Mike, in an earlier thread, I made the bold claim that MOVEA was
a useless opcode, now that the string builtins are so powerful.
I challenged the mailing list to come up with a reasonable use
for MOVEA.  Do we have a candidate here?  What's the problem
being solved by setting those elements to 'X'?

Barbara Morris



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.