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



On Wed, Oct 22, 2008 at 11:25 PM, Mark S. Waterbury
<mark.s.waterbury@xxxxxxx> wrote:
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.

I wasn't aware of this, do you have a link to the documentation that says this.


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


I thought the opposite was true. RPG's "scatter/gather" as you called
it, made RPG a poorer performer than COBOL.

At least until v5r2 and the ability to do file I/O directly to a data
structure which narrowed the gap. I couldn't find the message from
Barbara Morris that I was looking for, but there's a blurb in the v5r2
announcement http://www-01.ibm.com/cgi-bin/common/ssi/ssialias?infotype=an&subtype=ca&htmlfid=897/ENUS202-130&appname=usn&language=enus
or http://tinyurl.com/5u3k6d
"Data-structure result for externally-described files: A data
structure can be specified in the result field when using I/O
operations for externally-described files. Before V5R2, this was
available only for program-described files. Using a data structure can
improve performance if there are many fields in the file. "

Also I did find this thread:
http://archive.midrange.com/rpg400-l/200705/msg00753.html

Charles Wilt

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.