|
Craig Pelkie wrote:
This is in some old code we are looking at:. . .
C U1
CANNU1 MOVE X2DAT X2DAT 6 0
It looks like an obscure way to define a field.
Yes, I would say that a MOVE statement copying a variable onto itself,
conditioned so it can never execute, is a ridiculous waste of
instructions (hopefully, the compiler is smart enough to squeeze them
out), when one can simply define the field the first time it appears in
the RESULT column.
But statements like MOVE, ADD, Z-ADD, IFEQ, &c., and defining variables
inline, are not only inherent to RPG; they are far more idiomatic to RPG
than EVAL or IF, and far more idiomatic than defining variables in
D-specs. That doesn't mean I don't use EVAL, or IF, or that I don't
define variables in D-specs (let's face it, complex calculations and
conditions are almost impossible without the former, and if you need a
variable to be of a non-default type, you HAVE to do the latter); I just
recognize them as non-idiomatic (albeit not nearly as non-idiomatic as
"/free" is).
Which brings up a point I keep having to make: if you don't use The
Cycle, and you don't like RPG syntax, then why are you bothering to use
RPG at all? There *are* other languages. (And if there had been more
demand for, say, PL/I, it would have probably been ported to ILE.)
--
JHHL
Proudly a Mixed-Language Programmer Since 1980
--
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 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.