×
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.
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
As an Amazon Associate we earn from qualifying purchases.