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


  • Subject: Re: MOVE and Z-ADD are **NOT**THE**SAME** (was Z-ADD or Eval?)
  • From: Jim Langston <jlangston@xxxxxxxxxxxxxxxx>
  • Date: Wed, 23 Aug 2000 15:57:56 -0700

Well, to be honest, I was talking about z-add in general.  That code snipped I 
included
I just happened to have in a program in front of me so I cut and pasted it.

From some comments, I should use Clear instead of Eval or Z-Add, and I'll take 
that
into consideration, but I'm kinda used to *Zero and *Blanks and it is easy for 
me to
spot in a program.  Unless there is some underlying reason to use Clear insead 
of *Zero
or *Blanks I think it's just a syntactical choice.

I think I see the whole thing, now, with Barbara's input.  Z-Add and Move do 
two different
things at times.  Z-Add and Eval Number = *Zero are the same.  I knew they did 
something
different, just didn't know what.

So, I should use Eval instead of Z-Add with a number not equal to 0, and Clear 
or Eval for
numbers equal to 0 depending on how I want to code it.  Unless, of course, 
Clear is faster
or more effecient than Eval Number = *Zero or Eval String = *Blanks.

Regards,

Jim Langston

jt wrote:

> Barbara,
>
> I agree with everything you said.
>
> My comment was only regarding Jim Langston's original question which was
> specifically about MOVE/Z-ADD of *ZEROS.
>
> jt
>
> -----Original Message-----
> From: owner-rpg400-l@midrange.com [mailto:owner-rpg400-l@midrange.com]On
> Behalf Of bmorris@ca.ibm.com
> Sent: Wednesday, August 23, 2000 12:58 PM
> To: RPG400-L@midrange.com
> Subject: Re: MOVE and Z-ADD are **NOT**THE**SAME** (was Z-ADD or Eval?)
>
> >Date: Tue, 22 Aug 2000 15:44:28 -0500 (CDT)
> >From: Scott Klement <klemscot@klements.com>
> >
> >Ummm...  why would Z-Add be more efficient than MOVE? That seems odd to
> >me.  Math is slower than just moving bytes around...
>
> >Date: Tue, 22 Aug 2000 19:05:29 -0400
> >From: "jt" <jt@ee.net>
> >
> >I was always told that, on the S/38, MOVE and Z-ADD created the exact same
> >MI instruction.  I verified this is still true today by looking at the IRP
> >from an RPG compile by specifying GENOPT(*LIST).  Both use the same MI
> >instruction 'copy numeric value 0.0 to field X':
> >
> >CPYNV X,P'0.0'
>
> MOVE between numerics is not usually just a matter of moving bytes around.
> Also it's not the same as Z-Add.
>
> This: MOVE  123.45   P    7 4
> doesn't do the same thing as
> this: Z-ADD 123.45   P    7 4
>
> Sure, the same code is generated for Z-ADD *ZEROS and MOVE *ZEROS.  And
> maybe even occasionally for other MOVE/Z-ADD pairs. But in general, MOVE
> and Z-ADD don't generate the same code because they don't mean the same
> thing.  Try my code above.  Also, check the results.  Set P to 999.9999
> before you do the Z-ADD or the MOVE.
>
> Barbara Morris

+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.