|
Hi, Eric:
You might gain a small performance advantage on each I/O, but if you do
much arithmetic with any zoned fields, your performance will suffer
because the compiled code must convert zoned to packed internally to do
any arithmetic, and then covert back to zoned again when storing the
results into your zoned fields. If you do this in a loop, for example,
the added overhead to convert back and forth between packed and zoned
will start to dominate the total CPU consumed.
By design, RPG is a "scatter/gather" language. On input, it copies (or
"scatters") all fields from the record buffer into equivalent working
storage fields, and converts all zoned fields into packed working
storage fields at that time. That way, all calculations (math, etc.)
can proceed at full speed, as the working storage fields are already in
packed format. Then, only when you WRITE or UPDATE the record, the
fields are "gathered" from working storage back into the record buffer,
and any packed working storage fields are converted back to zoned where
needed, and the record is written out.
This is one reason why, in many cases, if you re-wrote a program
line-for-line from ILE RPG IV into ILE COBOL or ILE C, if the program
does a fair amount of calculations with any of the zoned fields, the RPG
version will usually outperform the COBOL or C version by a wide margin.
(This was also true for OPM RPG/400 vs. OPM COBOL or OPM PL/I, etc.)
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.