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



At one time there was no such op-code as Z-ADD. Also, factor 1 always had to be filled in.

So the only way to clear FIELDB was with a blank-after in the O specs or something like this:
C FIELDB MOVE *ALL'0' FIELDB
or
C FIELDB SUB FIELDB FIELDB
or
C FIELDB MULT 0 FIELDB

C FIELDA ADD FIELDB FIELDB

The Z-ADD op code was a breakthrough. :)

Z-ADD is "zero then add" or "zero the result field and then add factor 1 and factor 2".






On 3/24/2011 5:10 AM, Craig Pelkie wrote:
Another question about "why" (not "what is it doing").

Why use a MOVE opcode when initializing a numeric field as opposed to the
more clearly numeric-only Z-ADD opcode?

The question is motivated towards understanding what the historical bias
was, in terms of choosing MOVE instead of Z-ADD.

Craig Pelkie


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Jim Franz
Sent: Wednesday, March 23, 2011 8:43 PM
To: RPG programming on the IBM i / System i
Subject: Re: Question about legacy coding style

in S36 code that would be
C U1NU1 MOVE X2DAT X2DAT 6 0

and your probably correct - to define a field& someone felt it must never
be executed...

In the 80's i did one of these in a subroutine executed 1st time into
calcs..

C MOVE *ZEROS X2DAT 6 0
or
C Z-ADD 0 X2DAT 6 0

Jim Franz
----- Original Message -----
From: "Craig Pelkie"<craig@xxxxxxxxxx>
To:<rpg400-l@xxxxxxxxxxxx>
Sent: Wednesday, March 23, 2011 11:20 PM
Subject: Question about legacy coding style


This is in some old code we are looking at:

C U1
CANNU1 MOVE X2DAT X2DAT 6 0

C U1
CANNU1 MOVE X2UDAT X2UDAT 6 0

C U1
CANNU1 MOVE X2TDT2 X2TDT2 6 0

C U1
CANNU1 MOVE X2DDAT X2DDAT 6 0


It looks like an obscure way to define a field.

What was the reasoning behind defining it like this?

Thanks,
Craig Pelkie


--
This is the RPG programming on the IBM i / System i (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.




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.