<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:clearspace="http://www.jivesoftware.com/xmlns/clearspace/rss" version="2.0">
  <channel>
    <title>RPG Team Blog</title>
    <link>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog</link>
    <description />
    <pubDate>Fri, 18 Sep 2009 19:08:50 GMT</pubDate>
    <generator>Clearspace 1.10.7 (http://jivesoftware.com/products/clearspace/)</generator>
    <dc:date>2009-09-18T19:08:50Z</dc:date>
    <item>
      <title>RPG's "Move fields" logic, and its cousin EVAL-CORR</title>
      <link>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/2009/09/18/rpgs-move-fields-logic-and-its-cousin-evalcorr</link>
      <description>One of the cool features of RPG is the "move fields" logic where data is moved from input buffers to program fields and from program fields to output buffers.  Most RPG programmers don't think of this as cool - it is so fundamental to RPG that RPG programmers take it for granted.&lt;br /&gt;
&lt;br /&gt;
When the RPG programmer defines a file in the RPG source, the compiler implicitly generates an internal program field for each field in the file, and the compiler also implicity moves data from the I/O buffers to the program fields for read and write operations to the file.  If a particular field name appears in more than one file used by the RPG program, the field can be read from one file and then written out to the other file without any effort on the part of the RPG programmer.&lt;br /&gt;
&lt;br /&gt;
Example: Say files FILE1 and FILE2 files have fields NAME and ADDR.  A READ operation reads both those fields from file1 and a WRITE operation writes both those fields out to file2.  It's not necessary to mention the field names in the source unless the fields are needed for some calculation.&lt;br /&gt;
&lt;pre class="jive-pre"&gt;&lt;code class="jive-code jive-plain"&gt;    read FILE1;
    write FILE2;
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
If a new field CITY is added to both files, and the program is recompiled, the CITY field will automatically be handled by the READ and WRITE.  No change is required to the program source.&lt;br /&gt;
&lt;br /&gt;
If you look in your compiler listing, you can see the I and O specs that the compiler generates.  These specs are not just descriptions of the I/O buffers.  They are executable operations.  The I specs are move operations from the Input buffer to the program fields, and the O specs are move operations from the program fields to the output buffer.  It is because the I and O specs are executable operations to and from program fields that it's possible to have a field defined as packed in a database file and zoned in a screen file.  RPG just does any necessary conversions when it move the data between the I/O buffers and the program fields.&lt;br /&gt;
&lt;br /&gt;
You can see the I and O specs in action by stepping through the I and O specs in the debugger.  You have to compile with OPTION(*DEBUGIO) and use the listing debug view.&lt;br /&gt;
&lt;br /&gt;
The "move-fields" logic has always been part of RPG, or I should say it has been at least since RPG II.  (I don't know much about the original RPG prior to RPG II.)&lt;br /&gt;
&lt;br /&gt;
The EVAL-CORR opcode (added in v5r4) works in a similar way.  If the READ and WRITE operations use data structures instead of using the I and O specs, you can assign all the same-name subfields from one data structure to another without actually mentioning the subfields by name.  Just like the example above, the following code will automatically handle the new CITY subfields when the program is recompiled after the CITY fields are added to the files.&lt;br /&gt;
&lt;pre class="jive-pre"&gt;&lt;code class="jive-code jive-plain"&gt;    read FILE1 ds1;
    eval-corr ds2 = ds1;
    write FILE2 ds2;
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Even though I do think it is very cool the way RPG automatically handles the fields from files, I sometimes wonder if it would be better in the long run for program maintenance to have the movement of field data from file to file be more explicit.  But that's a topic for another blog post.</description>
      <category domain="http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/tags">rpg</category>
      <pubDate>Fri, 18 Sep 2009 19:14:31 GMT</pubDate>
      <author>barbara_morris</author>
      <guid>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/2009/09/18/rpgs-move-fields-logic-and-its-cousin-evalcorr</guid>
      <dc:date>2009-09-18T19:14:31Z</dc:date>
      <clearspace:dateToText>2 months, 6 days ago</clearspace:dateToText>
      <clearspace:replyCount>1</clearspace:replyCount>
      <wfw:comment>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/comment/rpgs-move-fields-logic-and-its-cousin-evalcorr</wfw:comment>
      <wfw:commentRss>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/feeds/comments?blogPostID=1260</wfw:commentRss>
    </item>
    <item>
      <title>From ENDDO to LIKEFILE - my 20th RPG anniversary</title>
      <link>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/2009/07/31/from-enddo-to-likefile-my-20th-rpg-anniversary</link>
      <description>Today is the 20th anniversary of my arrival at IBM and also my arrival in the AS/400 RPG Compiler Development department.  The day I arrived, almost everyone was on vacation - there were only 3 other people working.  It was near the end of development for V1R3.&lt;br /&gt;
&lt;br /&gt;
My first couple of days were spent on an off-site RPG II self-study course, with no actual computer but only coding sheets to work with.  Much of my time was spent scratching my head wondering why anyone would actually choose to code in this bizarre language.&lt;br /&gt;
&lt;br /&gt;
When I got back, one of my co-workers showed me the online education system and told me to go through all the lessons, to learn about jobs, output queues, message queues, joblogs etc.  (Too bad they took that education system away - it was very good.)  He also told me to write an RPG program, using RPG/400 - nobody in the department was using RPG II except to investigate PMRs.  I vaguely recall that it was a program to read all records of a file and output them to a printer file.  And then a program to just do some calculations and write to a printer file.  That's when I learned about the mysteries of "LR".  ("What do you mean, the last record of the file?  This program doesn't have a file."  (Thanks, Y K, if you're reading this.  You were a good teacher.)&lt;br /&gt;
&lt;br /&gt;
The next week, with most people still on vacation, I started working on PMRs and APARs.  On my first day, I got a call from support asking me to talk to a customer and explain why the SETLL opcode was behaving the way it was.  &lt;b&gt;Talk to a customer?&lt;/b&gt;  &lt;b&gt;About SETLL?!?&lt;/b&gt;  &lt;b&gt;What on earth is SETLL?&lt;/b&gt;"  "Can you call me back in an hour?", I asked.  "Sure."  I found the SETLL opcode in the manual and read what I thought was a very clear explanation of how it worked.  There was a paragraph that answered the customer's question exactly.  When I finally was talking to the customer, I just read out that paragraph.  The customer was very pleased with the clear explanation.&lt;br /&gt;
&lt;br /&gt;
Around my sixth month, I got my first development project!  It was to update the END opcode to allow ENDIF and ENDDO etc.  During my design review, I was a bit taken aback by the amount of discussion about whether it should be just ENDDO to end DO/DOU/DOW, or ENDDO/ENDDU/ENDDW.  Strangely, I can't remember whether just-ENDDO was my original design, or whether the design was changed to just-ENDDO during the meeting.  I do remember that the key reason for just-ENDDO was to make it easier to change from one do-loop to another.&lt;br /&gt;
&lt;br /&gt;
Along the way, some of the more memorable enhancements I've developed were: SORTA for overlay arrays, subprocedures, %EDITC/%EDITW, call-interaction with Java, LIKEDS, and XML-INTO, and local-files and file-parameters.&lt;br /&gt;
&lt;br /&gt;
It's 20 years since that first RPG II course, and I'm still in the team that develops the RPG compilers for IBM i.&lt;br /&gt;
&lt;br /&gt;
And now I can't imagine why anyone &lt;b&gt;wouldn't&lt;/b&gt; want to code in RPG.</description>
      <category domain="http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/tags">rpg</category>
      <pubDate>Fri, 31 Jul 2009 15:17:47 GMT</pubDate>
      <author>barbara_morris</author>
      <guid>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/2009/07/31/from-enddo-to-likefile-my-20th-rpg-anniversary</guid>
      <dc:date>2009-07-31T15:17:47Z</dc:date>
      <clearspace:dateToText>3 months, 3 weeks ago</clearspace:dateToText>
      <clearspace:replyCount>4</clearspace:replyCount>
      <wfw:comment>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/comment/from-enddo-to-likefile-my-20th-rpg-anniversary</wfw:comment>
      <wfw:commentRss>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/feeds/comments?blogPostID=1229</wfw:commentRss>
    </item>
    <item>
      <title>Everyone should be coding the CCSID(*CHAR) keyword</title>
      <link>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/2009/07/17/everyone-should-be-coding-the-ccsidchar-keyword</link>
      <description>&lt;b&gt;The problem&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Strange but true: By default, RPG assumes that the CCSID of alphanumeric data is the mixed double-byte + single-byte  CCSID that is related to the job CCSID. &lt;br /&gt;
&lt;br /&gt;
This matters when all of the following conditions are met&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;(very common) the actual job CCSID is a single-byte CCSID such as 37&lt;/li&gt;
&lt;li&gt;(quite common) conversions are done between alphanumeric data and UCS-2 data&lt;/li&gt;
&lt;li&gt;(rare) the alphanumeric data contains shift characters (x'0E' or x'0F')When the alphanumeric data is being converted to UCS-2, and the CCSID is assumed to be a mixed-byte CCSID, the "shift out" character x'0E' signals that the following data is double byte data; when the "shift in" character x'0F' is encountered, this signals a return to single byte data.&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
If this data is being converted to Unicode, and the data is not really supposed to be interpreted as mixed-byte data, then the Unicode version of the data will not be correct.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;The solution&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Code CCSID(*CHAR:*JOBRUN) in the H spec of all your modules. &lt;br /&gt;
&lt;br /&gt;
If you are actually using a mixed JOB CCSID, nothing will change.  If you are actually using a single byte CCSID, any conversions involving alphanumeric data containing x'0E' will be correct.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;But I never have x'0E' in my single byte alphanumeric data&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
What never? &lt;br /&gt;
&lt;br /&gt;
Well, hardly ever ...</description>
      <category domain="http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/tags">rpg</category>
      <category domain="http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/tags">ccsid</category>
      <pubDate>Fri, 17 Jul 2009 18:27:31 GMT</pubDate>
      <author>barbara_morris</author>
      <guid>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/2009/07/17/everyone-should-be-coding-the-ccsidchar-keyword</guid>
      <dc:date>2009-07-17T18:27:31Z</dc:date>
      <clearspace:dateToText>4 months, 1 week ago</clearspace:dateToText>
      <wfw:comment>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/comment/everyone-should-be-coding-the-ccsidchar-keyword</wfw:comment>
      <wfw:commentRss>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/feeds/comments?blogPostID=1223</wfw:commentRss>
    </item>
    <item>
      <title>Notes from RPG &amp;#38; DB2 Summit in Orlando</title>
      <link>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/2009/04/17/notes-from-rpg-38-db2-summit-in-orlando</link>
      <description>Orlando Summit is almost over.  Except for the (not unexpected) lower attendance, it has been an excellent Summit.  The Summit attendees are always very motivated to learn; almost all of them attend a session in every available time slot.  Over 80% of them even attend the 8 am "early bird" sessions. &lt;img class="jive-emoticon" border="0" src="http://www-949.ibm.com/software/rational/cafe/images/emoticons/alert.gif" alt="(!)" /&gt;  That's dedication.&lt;br /&gt;
&lt;br /&gt;
But if possible, everyone here seemed even more motivated to learn than usual.  People asked more questions (and more interesting questions) during my sessions than usual.&lt;br /&gt;
&lt;br /&gt;
I was excited (and nervous) to talk about other Rational products besides the RPG compiler, both at the IBM-Rational booth that I was manning, and at the Intro to RTCi session I gave.  There was a fair amount of interest in RTCi at the booth, and a few very interested people came to the presentation.  I learned a lot myself at the presentation; I can see where RTCi will be a boon for people who currently have only informal ways of managing their projects.</description>
      <category domain="http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/tags">rpg</category>
      <category domain="http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/tags">summit</category>
      <category domain="http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/tags">rtci</category>
      <pubDate>Fri, 17 Apr 2009 17:45:30 GMT</pubDate>
      <author>barbara_morris</author>
      <guid>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/2009/04/17/notes-from-rpg-38-db2-summit-in-orlando</guid>
      <dc:date>2009-04-17T17:45:30Z</dc:date>
      <clearspace:dateToText>7 months, 1 week ago</clearspace:dateToText>
      <wfw:comment>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/comment/notes-from-rpg-38-db2-summit-in-orlando</wfw:comment>
      <wfw:commentRss>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/feeds/comments?blogPostID=1185</wfw:commentRss>
    </item>
    <item>
      <title>What is Web 2.0?</title>
      <link>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/2009/03/21/what-is-web-20</link>
      <description>If you are in the Toronto area, the &lt;a class="jive-link-external" href="http://www.tug.on.ca/tec/"&gt;Toronto User Group TEC 2009 conference&lt;/a&gt; starts next week Tue (Mar 24-26)&lt;br /&gt;
&lt;br /&gt;
For those curious about Web 2.0, latest trends, and how it can be consumed or produced on IBM i, George Papayiannis and myself will be presenting a session called "What is Web 2.0?" Tue @2:55.&lt;br /&gt;
&lt;p /&gt;
&lt;img src="http://www.tug.on.ca/tec/Graphics/TEC2009.jpg" alt="http://www.tug.on.ca/tec/Graphics/TEC2009.jpg" class="jive-image"  /&gt;</description>
      <category domain="http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/tags">web2.0</category>
      <category domain="http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/tags">ibm_i</category>
      <category domain="http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/tags">twitter</category>
      <category domain="http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/tags">blogs</category>
      <category domain="http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/tags">ajax</category>
      <category domain="http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/tags">wikis</category>
      <category domain="http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/tags">social_networking</category>
      <category domain="http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/tags">mashups</category>
      <category domain="http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/tags">rss</category>
      <category domain="http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/tags">atom</category>
      <pubDate>Sun, 22 Mar 2009 00:01:23 GMT</pubDate>
      <author>batthis</author>
      <guid>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/2009/03/21/what-is-web-20</guid>
      <dc:date>2009-03-22T00:01:23Z</dc:date>
      <clearspace:dateToText>8 months, 1 week ago</clearspace:dateToText>
      <wfw:comment>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/comment/what-is-web-20</wfw:comment>
      <wfw:commentRss>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/feeds/comments?blogPostID=1175</wfw:commentRss>
    </item>
    <item>
      <title>Performance tip</title>
      <link>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/2008/11/13/performance-tip</link>
      <description>&lt;h1&gt;&lt;b&gt;Here is the tip: Beware of performance tips&lt;/b&gt; &lt;/h1&gt;
&lt;p /&gt;
For me, the performance rule that never changes is this one: Always&lt;br /&gt;
question any rule you hear about X performing badly, or Y performing&lt;br /&gt;
better than Z. &lt;br /&gt;
&lt;p /&gt;
&lt;ul&gt;
&lt;li&gt;Was it ever true?&lt;/li&gt;
&lt;li&gt;Is it still true?&lt;/li&gt;
&lt;li&gt;Might it change in the future?&lt;/li&gt;
&lt;li&gt;Can I measure the difference?&lt;/li&gt;
&lt;li&gt;Does it apply to my current situation?&lt;/li&gt;
&lt;li&gt;Does the difference matter enough to code in a more complex or error-prone way?&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
The trouble with performance rules is that even when they are valid&lt;br /&gt;
rules, people tend to remember them too long. This can cause people to&lt;br /&gt;
cling to what has become a poorer-performing way of coding, or cause&lt;br /&gt;
them to code in unnecessarily awkward ways.&lt;br /&gt;
&lt;br /&gt;
Here are some commonly held "rules" to question&lt;br /&gt;
&lt;p /&gt;
&lt;ul&gt;
&lt;li&gt;SETLL + READ performs better than CHAIN&lt;/li&gt;
&lt;li&gt;SQL is slower than RPG&lt;/li&gt;
&lt;li&gt;Using VARLEN fields in database slows down the file&lt;/li&gt;
&lt;li&gt;Subroutine calls are faster than subprocedure calls&lt;/li&gt;
&lt;li&gt;Packed variables perform better if they have an odd number of digits&lt;/li&gt;
&lt;li&gt;Flying is faster than taking a train&lt;/li&gt;
&lt;/ul&gt;</description>
      <pubDate>Thu, 13 Nov 2008 23:49:19 GMT</pubDate>
      <author>barbara_morris</author>
      <guid>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/2008/11/13/performance-tip</guid>
      <dc:date>2008-11-13T23:49:19Z</dc:date>
      <clearspace:dateToText>1 year, 1 week ago</clearspace:dateToText>
      <wfw:comment>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/comment/performance-tip</wfw:comment>
      <wfw:commentRss>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/feeds/comments?blogPostID=1085</wfw:commentRss>
    </item>
    <item>
      <title>Welcome to the RPG Development team blog</title>
      <link>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/2008/11/13/welcome-to-the-rpg-development-team-blog</link>
      <description>&lt;br /&gt;
The RPG compiler development team handles the design, development, testing and documentation of the RPG compilers. We are part of a larger team that also develops RDi and RTCi.&lt;br /&gt;
&lt;br /&gt;
The team is situated in Toronto, Ontario, Canada.</description>
      <category domain="http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/tags">rpg</category>
      <pubDate>Thu, 13 Nov 2008 23:38:26 GMT</pubDate>
      <author>barbara_morris</author>
      <guid>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/2008/11/13/welcome-to-the-rpg-development-team-blog</guid>
      <dc:date>2008-11-13T23:38:26Z</dc:date>
      <clearspace:dateToText>1 year, 1 week ago</clearspace:dateToText>
      <wfw:comment>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/comment/welcome-to-the-rpg-development-team-blog</wfw:comment>
      <wfw:commentRss>http://www-949.ibm.com/software/rational/cafe/blogs/rpg-team-blog/feeds/comments?blogPostID=1084</wfw:commentRss>
    </item>
  </channel>
</rss>

