Lim Hock-Chai wrote:
Jeff - Actually, every RPG program uses default RPG cycle regardless of
how files is open/close file. Obviously, when I say cycle programming,
I mean "cycle" programming. Otherwise, James statement about "Anybody
who would give that answer to "What is The Cycle good for?" would be
better off using another language." would be irrelevant.
I'm afraid I have to disagree.
1. You don't have to "use" The Cycle at all (and probably no more than a
third of the RPG programs I've written, and considerably fewer of those
I have a hand in maintaining) actually "use" it. You can bypass it, by
either doing an explicit RETURN, or by explicitly raising LR, or (as I
understand it, in the latest compilers) you can even suppress it. The
only thing you CAN'T do is ignore it.
2. In a lot of cases, one uses RPG because it's the only language
available, or because you're writing something that might have to be
maintained by someone who doesn't necessarily speak a language better
suited to the problem at hand, or because the only other choice that
would work at all is ILE C, and database access from ILE C is a royal
pain in the <equus asinius>. But if you can't recognize situations where
using The Cycle can simplify a program, you probably are better off
using another language.
You don't use every tool every day, but that's no reason not to know
what the tools you have are good for, and how to use them.
In my toolbox at home, I have a pair of flush-cut rail nippers, even
though it's been over two decades since I've laid any model railroad
tracks. They're not a tool I use every day, and if I caught somebody
abusing their delicate edges to cut steel wire, I might be inclined to
use them as a weapon, but every so often, when I need to cut off a soft
metal or plastic rod flush and square, I reach for the rail nippers.
As an Amazon Associate we earn from qualifying purchases.