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



I think the %div documents the intention better. Reason is that if I go in to look at a program and am looking at the code itself then it isn't obvious that the two fields are related unless you go find there definition in the data structure.

For instance, if you have two lines of code.

Num6 = something();
Somethingelse(num4);

Just looking at that I start wondering where did num4 come from and have to go searching where if you have the following it is easier for me to understand right away.

Num6 = something();
Somethingelse(%div(num6:100));

If you spend a lot of time looking at code just to answer a simple question about what it does in certain circumstances then you may only look at a little bit of the code and it makes it easier to me at least to not have to go looking elsewhere to understand it.

Scott

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Gary Thompson
Sent: Monday, December 09, 2013 10:27 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: RE: Alternatives to MOVEL - just curious

I agree with everything John says, but
I do prefer the DS because I think it
documents the intention better . . .

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of John Yeung
Sent: Monday, December 09, 2013 10:24 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Alternatives to MOVEL - just curious

What I always do for these is %DIV:

num4 = %div(num6:100);

(Or %rem for the cases where you want a MOVE.)

To me, this is simpler than a data structure because it saves lines of D-specs. However, I don't think anything will perform faster than a data structure, because that requires essentially no (execution) overhead at all, not even a move. In most cases, %DIV is plenty fast enough.

John

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.