<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>RPG and Programming</title>
	<atom:link href="http://www.rpgandprogramming.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rpgandprogramming.com</link>
	<description>Not Role Playing Games, but the RPG programming language and the craft of programming.</description>
	<pubDate>Sat, 03 Dec 2011 17:32:14 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>en</language>
			<item>
		<title>The Human Factor</title>
		<link>http://www.rpgandprogramming.com/2011/12/the-human-factor/</link>
		<comments>http://www.rpgandprogramming.com/2011/12/the-human-factor/#comments</comments>
		<pubDate>Sat, 03 Dec 2011 17:32:14 +0000</pubDate>
		<dc:creator>Curtis Barron</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[RPG]]></category>

		<category><![CDATA[RPG Freeform]]></category>

		<category><![CDATA[RPGIV]]></category>

		<guid isPermaLink="false">http://www.rpgandprogramming.com/?p=275</guid>
		<description><![CDATA[
Still another example of the human factor being one of the greatest hindrances in solving computer problems - the willingness to see what one expects to see and to make assumptions.
I was writing a report that required me to accumulate data into arrays in the program, which, associated together in a data structure, could then [...]]]></description>
			<content:encoded><![CDATA[<div>
<p>Still another example of the human factor being one of the greatest hindrances in solving computer problems - the willingness to see what one expects to see and to make assumptions.</p>
<p>I was writing a report that required me to accumulate data into arrays in the program, which, associated together in a data structure, could then be sorted appropriately with a SORTA statement. Below this, I had defined a separate, somewhat unrelated data structure.</p>
<p>In the array data structure, properly defined by the way, was an account number, followed by a short  name. When I printed the report, to my surprise I found the account number slopping over into the short name and practically missing in the account number field</p>
<p>I have WDSC, the PC program that color codes fields and opcodes and creates outlines of the code, including a cross-reference of the fields in the program. The cross references indicated only one spot where the account number and name fields would be updated. The update was airtight, as far as I could see, when I ran the program in debug. But at the point just before the second element of the arrays were to be updated, the first elements of the arrays were already changed!</p>
<p>I then looked a little more carefully at the “watch” facility of the debugger, which allows you to tell the debugger to tell you when the value of a specific field changes. After the first element of the array was filled, I told it to watch for when the first element of the account number changed. I then told the program to continue. Then the cursor stopped- at my input file definition!</p>
<p>“Now, what’s going on?” I said to myself.  The file was externally defined, but one field from the file was used in the data structure below the data structure defining the arrays. I looked at that data structure, and everything seemed to be in order. I checked other things, and I came back to that data structure and puzzled over it. And then I saw. The line  (with the DS in it) that forms the initial definition of the description had an asterisk in column 7 - for some reason along the way, I had commented the line out and neglected to remove the asterisk when I was done.</p>
<p>With that asterisk in the definition line, its data structure fields that followed became associated with the array data structure above. The field thus overlaid the first 11 bytes of the data structure array, which included the account number and name. The field was read in, and the arrays changed.</p>
<p>Even with the color coding of the editor, I completely missed the asterisk. I had seen  what I expected to see - the DS in the appropriate column. I missed the asterisk. Now, one could say that this is an argument for using the //  freeform notation for comments and devising a new, freeform, keyword style form for field and data structure definition. But there is more to it.</p>
<p>I would submit that, no matter what precautions we take, the human factor will come into play. At some point, no matter what notation we use, the problem being handled will become sufficiently complex that the human writing the program will start making assumptions so he can handle the volume of concepts and data coming in, and he will see the concepts in his program that he expects to see- even if they are not there.</p>
<p>Sometimes it’s best just to take a break.</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.rpgandprogramming.com/2011/12/the-human-factor/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Programmer and the Mailbox</title>
		<link>http://www.rpgandprogramming.com/2011/09/the-programmer-and-the-mailbox/</link>
		<comments>http://www.rpgandprogramming.com/2011/09/the-programmer-and-the-mailbox/#comments</comments>
		<pubDate>Sun, 04 Sep 2011 00:04:47 +0000</pubDate>
		<dc:creator>Curtis Barron</dc:creator>
		
		<category><![CDATA[Personal]]></category>

		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.rpgandprogramming.com/?p=265</guid>
		<description><![CDATA[A problem I have had to deal with at home has caused me to meditate on the mentality a programmer must have. Of course, my wife suspects that I may have a mild case of Asperger’s syndrome. If that is true, I would venture to say that there are some aspects of the ideal programmer’s [...]]]></description>
			<content:encoded><![CDATA[<p>A problem I have had to deal with at home has caused me to meditate on the mentality a programmer must have. Of course, my wife suspects that I may have a mild case of <a class="aligncenter" title="Asperger's" href="http://www.webmd.com/brain/autism/mental-health-aspergers-syndrome" target="_blank">Asperger’s syndrome</a>. If that is true, I would venture to say that there are some aspects of the ideal programmer’s mentality that may resemble autism- and when I say that I do not mean to make light of a serious medical disorder.</p>
<p><span id="more-265"></span> In our small town, the local post office made a request of the townspeople that they install mailboxes at the curb so that mail can be delivered from vehicles rather than hand-carried up to the house. (This request has not been well-heeded, but that is another issue.)</p>
<p>For many programmers, especially those with normal manual skills and brains, this would not be an earth-shaking task. My programming teacher, for example, could not only program, but he could change a transmission, remodel his basement, bake cheesecakes for sale to restaurants, and brew his own root beer. Not me. My manual skills are minimal; I can do many things that others can do, but not as well, and it takes me a lot more time.</p>
<p>Anyway, I asked the reasonable question, “Where exactly should the box go?” The directions from the post office, to a normal person, may have seemed clear: “The box should be 6 inches from the curb, and the bottom of the box should be 42 inches from the ground.” But the problem: The curb does not rise from right angles from the street. The curb arcs about 90 degrees, so the the top of the curb ends about 7 inches horizontally measured from the bottom of the curb. In other words, the top of the curb is already 7 inches from the street. Do I hang it 1 inch over the edge of the curb to get 6 inches from the street, or do I put it 6 inches from the top edge (13 inches from the street)? The top of the curb is about 7 inches higher than street level. Do I put the box 42 inches from street level (35 from ground level) or 42 inches from ground level (49 from street level)?<br />
My wife asked the maillady. She said that she thought that it was 42 inches from ground level. ( An opinion, not a ruling. No help.) The post is designed to be driven into the ground. After obliterating the first inch or so of the post with my sledgehammer, I sawed off the ruined post end, dug the hole and put the post in. Now that the post was in the ground and the adjustable mailbox support was in place, I looked more closely at the instructions that came with the mailbox post. It said,  ‘The bottom of the mailbox should be from 41 to 45 inches from street level; check with your local postal service.’ Mildly better; but it gave me a four inch range, and copped out by telling me, in the end, that the post office was the final authority.<br />
I can just see me writing a program with that level of lack of precision. In effect, I am being asked to wing it. Unless you are writing a program for your own amusement and edification, when you are writing programs YOU CAN’T WING IT! You are not allowed to make assumptions. Almost every mistake I have ever made as a programmer has been a result, at some level, of erroneous assumptions, whether at the coding, testing, or implementation level.  In other words, mistakes come in programming when you make human assumptions, when even for just a moment you forget that the program, and therefore the computer, does what you TELL it to do, not what you WANT it to do. For most programs, especially when being used  at a business level, “ALMOST CORRECT” IS NOT GOOD ENOUGH.<br />
This is especially true when dealing with financial applications. In my experience, the best person to talk to when developing specifications for a program is an accountant or other financial specialist. They seem to have a special appreciation for precision, even if they don’t know a lick about programming computers. And if a report is $10 off, or even 10 cents off, they want to know why. And that is a good thing. I appreciate that.<br />
I think that most programmers can relate to what I have just said. What amazes me is that you can have people who can deal with uncertainty in most other tasks but don’t tolerate it in their programming (my teacher, again, being an example). I need strict specifications in almost everything in my daily life. ( I once spent 15 or 20 minutes trying to decipher a wordless, picture-only description of how to install windshield wiper blades.)<br />
So how did I resolve my problem? I put the mailbox about 6 inches from the top edge of the curb (about thirteen inches from the street) and about 46 inches from street level (about 39 inches from ground level). Why? Because, since the box will probably never be filled from a vehicle at street level, I should do it for the walking mail carrier. I winged it. Fortunately, the height can be adjusted later, if needed.<br />
All very imprecise. And all very unsatisfactory.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rpgandprogramming.com/2011/09/the-programmer-and-the-mailbox/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Real World</title>
		<link>http://www.rpgandprogramming.com/2011/05/the-real-world/</link>
		<comments>http://www.rpgandprogramming.com/2011/05/the-real-world/#comments</comments>
		<pubDate>Sat, 28 May 2011 02:02:42 +0000</pubDate>
		<dc:creator>Curtis Barron</dc:creator>
		
		<category><![CDATA[Personal]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[RPG]]></category>

		<guid isPermaLink="false">http://www.rpgandprogramming.com/?p=257</guid>
		<description><![CDATA[I know it&#8217;s been quite a while since I&#8217;ve made an entry here, but sometimes real life intrudes on the fantasy world of the Internet, so I just became too distracted by the real world. Either that, or I&#8217;ve just gotten lazy.
I think of things to put into this every day while I&#8217;m at work. [...]]]></description>
			<content:encoded><![CDATA[<p>I know it&#8217;s been quite a while since I&#8217;ve made an entry here, but sometimes real life intrudes on the fantasy world of the Internet, so I just became too distracted by the real world. Either that, or I&#8217;ve just gotten lazy.</p>
<p>I think of things to put into this every day while I&#8217;m at work. Unfortunately, I&#8217;m at work when I get these ideas, I don&#8217;t make a note of it, or I get too tired when I get home, and the idea evaporates.</p>
<p>One idea that has managed to sustain itself until this evening was an observation on the state of programming in the real world – that is, outside my insulated IBM-i world. Of necessity, even my client must run outside programs and communicate with the outside world, and that is when the sadly amusing state of the computing world presents itself.</p>
<p>I listen as others talk about having to get new systems working on the new Windows 7 boxes. I listen to them go through the song and dance about installing this driver or that, and how it becomes difficult to keep the existing programs running when you get new hardware or install new software or both. After a while, you notice that it&#8217;s a new rendition of an old song with new singers and a new group of orchestras.</p>
<p>In the IBM-i world, of course, this stuff is nonsense. We are currently running programs that were written back in the 70&#8217;s and 80&#8217;s. With this IBM minicomputer (as it used to be called) family, it made no difference. The programs might need to be recompiled when you changed machines, but you didn&#8217;t  need to create a new version of it- you only did it if you wanted to. No wasted effort. Nothing about the programs had to be changed if the operating system changed versions. But in the Windows world (and I believe in the Linux world too), there are no such guarantees. This always puzzled me when I looked out at my Windows.</p>
<p>And it has touched my world. I played a little bit with VisualAge RPG, and one of my coworkers ran with the idea and wrote an entire system, albeit a relatively small one, using VARPG to talk to our AS/400. (I know, I know. It&#8217;s not what it&#8217;s called now, but it&#8217;s the name most people in the industry identify it with.)  We thought it was a very slick piece of work, even though we were aware that IBM wasn&#8217;t exactly pushing it. All we knew is that it was a very easy way to leverage our RPG skills into the Windows world. The users loved it.</p>
<p>But now, as time goes on and we get Windows 7 machines in, we have to make sure that if the system goes on a Windows 7 machine, it must be set up to run in XP-compatibility mode. But how long will that last? How long will it be before another “advancement” in Windows takes that option away from us? How long before it no longer becomes “cost effective” for Microsoft to have  an environment in which our programs can be run? Then we either have to rewrite them in another language, or we encase them in a virtual machine where it no longer matters what the outside world (operating system) is. I suppose I should be thankful that we at least have that option.</p>
<p>And you can tell that the mindset of the computing world in general is that somehow this is a good thing. Throwaway software. They worry about 32-bit and 64-bit software and the incompatibilities inherent in them. But it&#8217;s &#8220;progress&#8221;. I call it wasteful – but who am I? Just a grunt programmer in an increasingly less popular computing ecosystem.</p>
<p>Sorry, but I don&#8217;t have any solutions. I hope somebody does.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rpgandprogramming.com/2011/05/the-real-world/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Last GOTO</title>
		<link>http://www.rpgandprogramming.com/2011/02/the-last-goto/</link>
		<comments>http://www.rpgandprogramming.com/2011/02/the-last-goto/#comments</comments>
		<pubDate>Sun, 06 Feb 2011 05:03:45 +0000</pubDate>
		<dc:creator>Curtis Barron</dc:creator>
		
		<category><![CDATA[Personal]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[RPG]]></category>

		<category><![CDATA[RPG Freeform]]></category>

		<category><![CDATA[RPGIV]]></category>

		<guid isPermaLink="false">http://www.rpgandprogramming.com/?p=248</guid>
		<description><![CDATA[I have been reading and thinking about the future of my favored programming language and the computer platform upon which I use it. The latter has been the subject of an extended discussion in LinkedIn. Some feel that the naming of the machine is of little consequence, unless you use the wrong one. It is [...]]]></description>
			<content:encoded><![CDATA[<p>I have been reading and thinking about the future of my favored programming language and the computer platform upon which I use it. The latter has been the subject of an <a class="aligncenter" title="LinkedIn" href="http://www.linkedin.com/groupItem?view=&amp;srchtype=discussedNews&amp;gid=59314&amp;item=38753330&amp;type=member&amp;trk=EML_anet_ac_pst_ttle" target="_blank">extended discussion in LinkedIn</a>. Some feel that the naming of the machine is of little consequence, unless you use the wrong one. It is felt that to call it the AS/400 is inaccurate, since the AS/400 is not called that anymore- which is, of course, true. It is felt that RPG will not survive for an extended period of time because of its intimate connection via DDS (Data Description Specifications) with the 24 X 80 character display green-screen terminal. Others feel that newer innovations may allow it to survive, but only if it dispenses as quickly as possible with the fixed-format (“punch-card”) calculation specifications and move quickly to free-format. There are not many defenders of fixed-format RPG around, and those that  use it are probably expected to turn in their coding sheets soon and retire. And, as always, proponents of each view have their own facts and anecdotes to support their view.</p>
<p>I could not hope to make much of an impression on that forum and accomplish anything more than stir up the pot of contention. It is much better to make a one-sided argument here.  <img src='http://www.rpgandprogramming.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> Anyone who cares to argue may feel free to do so.<span id="more-248"></span></p>
<p>The matter of the naming of my favorite machine is to me a matter of importance. As some in that discussion pointed out, that machine continues to be called AS/400 even today, even though IBM gave up on that name a long time ago; but the name still appears in IBM documentation along with other names for it (iSeries, for example) that IBM has given up on.</p>
<p>The Ford Motor Company long ago created a vehicle it called a Ford. It also makes, or has made other brand names like Mercury and Lincoln. The Ford Model T was a roaring success. When the time came to upgrade its model line, did the company take the attitude, “This model will look nothing like the Model T, and certainly nothing like the first cars Mr. Ford created. We don&#8217;t want people thinking of those old cars when this new one comes out. We need to call it a Henry! Or perhaps use his initials- the HF1900+”?  No, they recognized the value of a brand name. To give another example, very soon after they discontinued the Ford Taurus, they brought the name back and gave it to another car, to give that car credibility.</p>
<p>To call the machine we use an AS/400 is recognition of its stability, which is likely a function of both hardware and operating system software. Only ignorant people outside the computer business would seriously think that calling it by its original name would imply that it only works in a dumb-terminal environment. I prefer to think that people in the computing business, in the world&#8217;s IT departments, are not that stupid. It&#8217;s a computer, for heaven&#8217;s sake. We can make it do whatever we want it to. People who run Windows XP, Windows Vista, or Windows 7 do not expect to encounter the General Protection Faults they encountered in Windows 3.1, just because they are all named Windows. If people who think like that are actually in responsible positions in the IT departments of their companies, I fear for the future of those companies.</p>
<p>That is probably enough about marketing stupidity. I am not a marketer, and I have not had training in it. It just seems obvious to me that if they felt there was such a burning need for a name change, they could have come up with some name that held onto the good reputation and name recognition it had engendered. Perhaps some variation that held onto to the “AS” prefix.</p>
<p>Readers of past entries may perhaps be aware of my feelings on some other topics I mentioned, like free-format languages. The C language, for example, is one of the most non-intuitive languages I have ever looked at. Its only claim to virtue is its popularity, which stemmed from from the fact that C, which really is an “old” language, came riding in as a free language used in association with Unix, and its use was seeded way back when by free distribution to college Computer Science students.</p>
<p>Free- format, as represented by C and other languages – as well as freeform RPG- is not a virtue in itself. <a class="aligncenter" href="http://www.rpgandprogramming.com/2008/06/and-the-1-reason-why-freeform-rpg-is-best-is/" target="_blank">See my earlier discussions on this subject.</a></p>
<p>It has been a problem that RPG is viewed as an IBM midrange language only. It may be too late to dispel that impression. I think it would be a great idea if IBM would release VisualAge RPG to the open-source community. The community would expand its use with a whole lot more vigor and enthusiasm than IBM seems ready to do. I think they would have an Internet HTML-style interface ready very quickly – much more quickly than IBM could or would by itself- and IBM could borrow the ideas back for use with the midrange box. The file access operations even now available in RPG (fixed format or free) are much more rich and elegant than just about any other language. Another language often used for data access is SQL; while I like its ability to pull together data sets, its single record access syntax (not to mention actual speed) to me seems positively kludgy compared with RPG.</p>
<p>But what do I know? I&#8217;m just a grunt programmer in a small town in the center of the U.S., old enough to retire, though I probably won&#8217;t, as least voluntarily, for a long time. My range of experience is nowhere as wide, and my education not nearly as deep, as that of many whose opinions I read and often value, though I have been in the business for over 30 years.</p>
<p>I view RPG pragmatically; compared with any other language I can conceive of on the midrange, it is a supremely elegant file access and data manipulation language, especially in its RPGIV incarnation. Any further attempts to make it look like another language like Java or C or Pascal would be positively a waste of time and energy. It is bloated enough already.</p>
<p>I think there is no reason why RPG could not be known and used by a wider range of the computing community. I can only wonder why this has not been so. People will not come to the IBM midrange to use PHP or Java. Programmers need to understand the virtues of RPG. And I can say that even though I haven&#8217;t the faintest idea how to go about doing it.</p>
<p>If someone does not do something to encourage the use of RPG, it will mean the eventual asssimilation of the IBM midrange (read AS/400, IBM i, iSeries, or whatever you want here) into the IBM conglomerate, since RPG has been so intimately connected with the individuality of the IBM minicomputer since its inception. The oldtimers will have to support RPG until it fades away, and I may be the last RPG programmer, being called in to fix one last program, to determine where that last GOTO goes to.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rpgandprogramming.com/2011/02/the-last-goto/feed/</wfw:commentRss>
		</item>
		<item>
		<title>I Saw the Light</title>
		<link>http://www.rpgandprogramming.com/2010/11/i-saw-the-light/</link>
		<comments>http://www.rpgandprogramming.com/2010/11/i-saw-the-light/#comments</comments>
		<pubDate>Sun, 21 Nov 2010 21:36:59 +0000</pubDate>
		<dc:creator>Curtis Barron</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[RPG]]></category>

		<category><![CDATA[RPGIII]]></category>

		<category><![CDATA[RPGIV]]></category>

		<guid isPermaLink="false">http://www.rpgandprogramming.com/?p=241</guid>
		<description><![CDATA[I have changed my mind again on this matter of using the RPGIII style of calling external programs instead of subprocedures, modules, service programs and all that sort of stuff. I am beginning to “see the light” about updating my coding style.
I don&#8217;t know why, but just out of the blue I started to mess [...]]]></description>
			<content:encoded><![CDATA[<p>I have changed my mind again on this matter of using the RPGIII style of calling external programs instead of subprocedures, modules, service programs and all that sort of stuff. I am beginning to “see the light” about updating my coding style.</p>
<p>I don&#8217;t know why, but just out of the blue I started to mess around with the service program concept. I must have 15 or 20 variations on date conversion routines: GTOJ for MMDDYY to Julian, ISOTODOW for inputting an ISO date (CCYYMMDD) and outputting the day of the week, and ISOTOVBG for inputting ISO and outputting a spelled-out date (in the format September 30, 2010) are just a few of them. Somehow I guess I felt that there was a natural grouping evident there that ought to be respected.</p>
<p>So anyway, I began exploring service programs a bit more. I think my main objection to modules was the fact that compilation would be a three-step process- compiling the two modules separately with CRTRPGMOD, then using CRTPGM to create the final program. I considered this to be an incredible nuisance. But I pressed on and put all my date modules into one service program. I then discovered that there was a way in the header specifications to use a “binding directory” to join the main program to modules. I found out how to put service programs into a binding directory, then reference the modules from there.</p>
<p>The final step was freeing myself from a misconception about the use of service programs. The article I was using for reference only referred to the use of CRTPGM. I found, though, that once the binding directory reference was inserted into the H spec, I could use CRTBNDRPG, just like I always do, so it could be a one-step compilation again. This was important beyond simple ease of use, because a number of other programs I had written, including my file/program cross-reference system, provided for recompilation of programs when requested. Before, the few programs that had external subprocedures always bombed on the CRTBNDRPG compile, and I could think of no easy way to create the proper CRTRPGMOD/CRTPGM combinations automatically. That is partly why I had retained the old CALL/PARM syntax, so I would not have to deal with that issue. Now, my problem has been solved.</p>
<p>So maybe there is hope for me yet.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rpgandprogramming.com/2010/11/i-saw-the-light/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Time Marches On</title>
		<link>http://www.rpgandprogramming.com/2010/08/time-marches-on/</link>
		<comments>http://www.rpgandprogramming.com/2010/08/time-marches-on/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 01:07:06 +0000</pubDate>
		<dc:creator>Curtis Barron</dc:creator>
		
		<category><![CDATA[Personal]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[RPG]]></category>

		<category><![CDATA[RPG Freeform]]></category>

		<category><![CDATA[RPGIV]]></category>

		<guid isPermaLink="false">http://www.rpgandprogramming.com/?p=236</guid>
		<description><![CDATA[It has been a long time since my last entry. Much has happened since then. I made two 2100 mile round trips by car back to Michigan, both of them in connection with my mother, who passed away in June at the age of 98. Other personal situations have cropped up too.
At my place of [...]]]></description>
			<content:encoded><![CDATA[<p>It has been a long time since my last entry. Much has happened since then. I made two 2100 mile round trips by car back to Michigan, both of them in connection with my mother, who passed away in June at the age of 98. Other personal situations have cropped up too.</p>
<p>At my place of work, I continue attempting to gradually upgrade the system. In addition to my assigned projects and troubleshooting, I am attempting to use more modern techniques; but I find it interesting to look back and see what things I have tried and not tried to do.</p>
<p>One thing that comes to mind is that I am no longer determined to find a way to gradually move code to free-format. If I write new code, it will probably be in RPG-free; but I am no longer attempting to translate fixed format to free. The job is just too daunting; so many of the old programs are just hideously loaded with indicators, and to do a direct conversion, using Linoma&#8217;s RPG Toolbox, creates code that would, especially to a neophyte, be even more confusing than its fixed format parent. With proper use of the toolbox we can eliminate left-hand indicators while leaving it in fixed format, and the tool does a very nice job of cleaning things up.</p>
<p>In another context, I am making changes that effectively are advancing beyond RPGIV as presently constituted. Using IBM routines CEESCEN, CEEDAYS, and CEEDATE, I am trying to free the system from its self-imposed reliance upon a century that runs from 1961-2060 for 2-digit years, as well as the ILE RPG range of 1940-2039 for 2-digit years. The boldest move, of course, would be to change all date references in the data files to at least an 8-digit year, if not actual date formats; but in ancient code from multiple systems, that would take a prohibitive amount of time to convert hundreds of files and programs to do this. What I have done instead is create a number of programs based upon the IBM programs above to quickly do date conversions. In doing this, I am implementing a sliding century, such that the two-digit dates will always reference a century that references the current year as the 40<sup>th</sup> year of the century. Currently, this means that my floating century is 1971-2070. In ten years, it will be 1981-2080.</p>
<p>A typical call would be:  To convert Gregorian (MMDDYY) to Julian, we would call:</p>
<p>CALL &#8216;GTOJ&#8217;</p>
<p>PARM                 ING      6  0</p>
<p>PARM                 JUL      5  0</p>
<p>You may note that I am using the RPGIII/RPG400 style of calling the program rather than using the one-line form:     CALLP(ING:JUL), which involves the creation of appropriate prototypes.  The program GTOJ, for instance, does consist of a module DCONV, which sets up and runs the IBM routines, and module GTOJ, which sets up the input and output for DCONV. They are then combined into program GTOJ. All the routines ultimately use DCONV.</p>
<p>However, I could not see the point of the extensive housekeeping involved in making the programs that call GTOJ and the other programs modularized. You, of course, have to create prototypes for each of the programs (about 15 of them, at last count). Of course, I could put them all in one service program, which to my mind creates another layer of unnecessary complexity. The chief justifications for this seem to be performance and the ability to catch inconsistencies between parameters of the called and calling programs. To me, these are not sufficient reasons. In this installation, performance will never be an issue. Trust me. Our new machine  (stupid word processor!   I can&#8217;t  put our favorite machine&#8217;s name here – OpenOffice keeps trying to capitalize it)  runs at least 10 times as fast as the one it replaced. As for parameter checking, any errors last until the first test is run, after which they are corrected.</p>
<p>Another thing that I have cooled on is attempting to get away from MOVE, etc , in existing code. New code that I write contains very few MOVEs, except for enabling date arithmetic. I just don&#8217;t see the point in changing existing code to remove MOVE, unless by doing so I can make the code clearer. IBM has not implemented MOVE in freeform, so I don&#8217;t see a meaningful amount of existing RPG code being moved to freeform. This means that any RPG neophyte is going to have to learn to deal with both freeform and fixed RPG formats in his maintenance programming.</p>
<p>So time marches on. We continue to watch the progress of IBM with its initiatives regarding RPG, and we wait to see what impact it will have on our day-to-day work. In a small installation like ours, I don&#8217;t think we will ever be cutting edge.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rpgandprogramming.com/2010/08/time-marches-on/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Bugged by the Debugger- and Larger Issues</title>
		<link>http://www.rpgandprogramming.com/2010/05/bugged-by-the-debugger-and-larger-issues/</link>
		<comments>http://www.rpgandprogramming.com/2010/05/bugged-by-the-debugger-and-larger-issues/#comments</comments>
		<pubDate>Mon, 31 May 2010 16:47:00 +0000</pubDate>
		<dc:creator>Curtis Barron</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[RPG]]></category>

		<category><![CDATA[Wirth]]></category>

		<guid isPermaLink="false">http://www.rpgandprogramming.com/?p=227</guid>
		<description><![CDATA[Sometimes the frustration you get from programming stems from a lack of knowledge. You think you have a mastery of a particular programming task, but the lack of knowledge comes back to bite you.
Such was the case a few weeks ago. I was debugging a program, and I wanted to to check the results of [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes the frustration you get from programming stems from a lack of knowledge. You think you have a mastery of a particular programming task, but the lack of knowledge comes back to bite you.</p>
<p>Such was the case a few weeks ago. I was debugging a program, and I wanted to to check the results of a basic calculation. I had changed the processing to no longer use a particular field. This field was defined in the input specifications (it was not externally defined). As I stepped through the calculations, I wanted to check the field, so on the command line I entered  EVAL  FIELD1. The result? It was <em>blank</em>.</p>
<p>I said to myself, “This is ridiculous- it can&#8217;t be!” It was part of the key to the file, and the file had no blank keys. I checked the value of KEY1, which included FIELD1 (that is, it included the data in the record encompassed by FIELD1. It looked normal. This was exasperating. I know that data in input specifications are stored in different areas of memory, even if they describe the same spot in the data record. But the field was blank. There were other fields that encompassed the same record space; some were blank, some weren&#8217;t.</p>
<p>I was vaguely aware that there was some sort of keyword in the H specifications you could use to eliminate unreferenced fields. But that would mean that I shouldn&#8217;t be able to debug it at all; it should give an error if I tried to EVAL it. And I didn&#8217;t use that keyword. I had one of my fellow programmers look over my shoulder as I ran the program in debug again. He didn&#8217;t have any idea what was going on either.</p>
<p>After all of this, we brainstormed a bit. I had no reason to suspect it before, but we thought: what if it is not showing up in debug because it is not being used? We could find nothing in the IBM RPG language documentation that something like that is done; but I inserted a dummy calculation: EVAL FIELD1=FIELD1.</p>
<p>Voila! The field now showed up, <em>filled with data</em>, in debug.</p>
<p>The most disagreeable part of it all was that I couldn&#8217;t find this behavior described anywhere in the documentation. I spent a little time Googling the situation – and sure enough, others described this behavior of the debugger. Apparently it is some kind of attempt to optimize the debugger. If you don&#8217;t use the field, the value is not filled in the debugger.</p>
<p>My reaction was, “Why bother?” Why assume that, just because another line of code doesn&#8217;t reference it, that I&#8217;m not interested in it? (This is an old program, by the way.) If the field is part of the file&#8217;s definition, it should be assumed that I&#8217;m interested in its value. I haven&#8217;t been able to find the documentation in a text document that describes how to use the debugger. The documentation may say something about it – if there is documentation. I couldn&#8217;t find anything in the help text for the debugger that described my situation. And I would think that a debugger, which deliberately allows you to sit at a line of code as long as you want, would be the last and least thing you would need  to have optimized.</p>
<p>But all of this speaks to a larger issue. Is this system getting too big? Is there any person around that actually knows <strong>everything</strong> about the behavior of the RPGIV compiler and its supporting programs, like the debugger? I don&#8217;t mean someone who knows where to <strong>look</strong> for the information (assuming of course <em>that it&#8217;s even all written down</em>), but someone who actually <strong>knows</strong> all this stuff, right down into all of the nooks and crannies, like this thing with the debugger, where some programmer or low-level committee apparently arbitrarily decided that we didn&#8217;t need to see the value of an unreferenced field in the debugger? If such a person exists, hide him from the world for six months and make him update the manuals so they include everything IN A COMPREHENSIBLE AND COMPREHENSIVE FORMAT.</p>
<p>I don&#8217;t pretend to know the answers to these questions. I don&#8217;t pretend to know the solutions to these problems. Maybe I&#8217;m just stupid. Maybe I just don&#8217;t know where to look. But I have for some time labored under the delusion that I have some measurable level of intelligence and that it shouldn&#8217;t be this hard to figure these things out.</p>
<p>This is a rant without a suggested solution. I can&#8217;t write my own compiler or supporting documentation. But it just strikes me that when Niklaus Wirth and a colleague can <a class="aligncenter" title="Oberon System" href="http://www.edm2.com/0608/oberon.html" target="_blank">write a non-trivial graphical operating system (Oberon) in just over 12000 lines of code in under 200K of space</a>, other people just as smart could make these systems we work with (possibly) smaller and (certainly) more comprehensible. Maybe it&#8217;s too late. I hope not.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rpgandprogramming.com/2010/05/bugged-by-the-debugger-and-larger-issues/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A Fantasy</title>
		<link>http://www.rpgandprogramming.com/2010/04/a-fantasy/</link>
		<comments>http://www.rpgandprogramming.com/2010/04/a-fantasy/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 02:21:14 +0000</pubDate>
		<dc:creator>Curtis Barron</dc:creator>
		
		<category><![CDATA[Control (level) breaks]]></category>

		<category><![CDATA[RPG]]></category>

		<category><![CDATA[RPGIV]]></category>

		<guid isPermaLink="false">http://www.rpgandprogramming.com/?p=224</guid>
		<description><![CDATA[In an alternative universe:
IBM Toronto
Press Release
April 1, 2010
RPG, from its very inception, has been designed to be an easy to use programming language. Since business data is stored in files, RPG was designed to make reading and writing files easy. To that end, its creators made sure that the processing of files was made easy [...]]]></description>
			<content:encoded><![CDATA[<p>In an alternative universe:<br />
IBM Toronto<br />
Press Release<br />
April 1, 2010<br />
RPG, from its very inception, has been designed to be an easy to use programming language. Since business data is stored in files, RPG was designed to make reading and writing files easy. To that end, its creators made sure that the processing of files was made easy by its READ and READE and READP operation codes, using a Pascal-like DO loop. Doing subtotals has been accomplished by the programmer storing intermediate data in temporary user-defined fields, then comparing group identifiers with the new identifiers and outputting the results before proceeding. Proper cascading logic enables the user to track multiple group changes that may need to be done at the same time.  CHAIN and READ make it possible to easily link related files.<span id="more-224"></span></p>
<p style="margin-bottom: 0in;">Batch file processing used to be the way to process data; but eventually the report became less important and the screen more so. Now, as SQL is used more and more,  with SELECTs and the use of a cursor, pseudo-batch processing has come more into vogue.</p>
<p style="margin-bottom: 0in;">With that in mind, we felt it was time to take a radical step to make batch processing more elegant. We have implemented in the latest release of RPGIV a new facility we have chosen to call “the RPG cycle”.</p>
<p style="margin-bottom: 0in;">With the RPG cycle, by declaring a file (using new file descriptors in the F specifications) as “primary” or “secondary”, you no longer need to issue explicit READ instructions. The compiler assumes you want to read the file or files from beginning to end. If only one file (primary) is used, you don&#8217;t even have to tell the system what file is being referred to. If a secondary file is also used, you use numbered Boolean variables or flags to identify a calculation as being associated with a particular file.</p>
<p style="margin-bottom: 0in;">We have also made it possible for the programmer to designate up to nine subgroups for totaling and other calculations associated with the subgroup. If a field designated as a subgroup identifier changes in value, the input data is held in buffers until calculations affecting that subgroup and all lower level subgroups have been completed in ascending level order (from 1 to 9).  There is NO need to save data in “hold fields”; the system handles all of that. These field changes are known as “level breaks”, and the calculations associated with them are called “level break calculations”. The changes are referenced or indicated by Boolean variables L1 through L9 (L standing for level). “LR”, now used to designate end of file (Last record) will activate all previous calculations and output for all levels in ascending numerical order.</p>
<p style="margin-bottom: 0in;">You can process files one after the other, or you can emulate SQL joins by associating related fields in the files with another Boolean variable called “matching record”, or MR.</p>
<p style="margin-bottom: 0in;">You can still use READ and CHAIN to process files, without reference to the cycle; using the new features of the cycle is entirely optional. You can also, within the cycle, read other files using CHAIN and READ operations.</p>
<p style="margin-bottom: 0in;">The beauty of the new process is that you don&#8217;t have to save the “level break” fields to process group totals. The system takes care of all the details. We have thus created a powerful, flexible system for batch file processing.</p>
<p style="margin-bottom: 0in;">Early reports from beta testers indicate a high level of appreciation for, and excitement about, the possibilities of the new process.</p>
<p style="margin-bottom: 0in;">Another new feature that has had programmers excited was enhancement of the printing functions of RPG. Now that PDF support has been implemented, the fact that printing is still important has been given more emphasis.</p>
<p style="margin-bottom: 0in;">We have been rethinking the whole print process, in an attempt to make it easier. In particular, it was felt that page overflow could be handled more elegantly. With this in mind, a new concept called “fetch overflow” has been implemented.</p>
<p style="margin-bottom: 0in;">Suppose you have heading output that depends upon your overflow indicators, defined as Boolean variables OA through OG, plus OV. With an appropriate entry in your output specifications, you no longer have to test for overflow in your calculations and write code to generate the output. The system checks whether overflow has occurred when the detail output is about to print. If it detects the overflow flag on, it outputs the heading lines designated to print at page overflow, then prints the detail line that triggered the process.</p>
<p style="margin-bottom: 0in;">If you set on the overflow flag in your *INZSR subroutine, your first page headings will print the very first time a detail line set for “fetch overflow” is encountered. Page control then becomes almost completely automatic. You no longer have to use EXCEPT output to print headings.</p>
<p style="margin-bottom: 0in;">Of course, you can still generate headings by testing for overflow manually, or you can count lines on the page. RPGIV retains flexibility in this area.</p>
<p style="margin-bottom: 0in;">We are extremely proud of the innovations in this release, and we are confident that the user community will also be happy with them.</p>
<p style="margin-bottom: 0in;">
<p style="margin-bottom: 0in;">The IBM RPGIV Compiler Team</p>
<p style="margin-bottom: 0in;">
<p style="margin-bottom: 0in;">Update:   April 15, 2010</p>
<p style="margin-bottom: 0in;">
<p style="margin-bottom: 0in;">Reaction to the upgrades has been enthusiastic, even exuberant. A typical response has been “We love it! It&#8217;s great!  RPG READ and SQL DECLARE CURSOR are so 20<sup>th</sup> century.”</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rpgandprogramming.com/2010/04/a-fantasy/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Who&#8217;s the Best Programmer Around? Not Me</title>
		<link>http://www.rpgandprogramming.com/2010/04/whos-the-best-programmer-around-not-me/</link>
		<comments>http://www.rpgandprogramming.com/2010/04/whos-the-best-programmer-around-not-me/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 04:27:59 +0000</pubDate>
		<dc:creator>Curtis Barron</dc:creator>
		
		<category><![CDATA[Personal]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[RPG]]></category>

		<category><![CDATA[RPGIV]]></category>

		<guid isPermaLink="false">http://www.rpgandprogramming.com/?p=214</guid>
		<description><![CDATA[My recent experience on the forum on Bob Cozzi&#8217;s RPGIV website underlined the fact that I am not in contention for the title of “World&#8217;s Best RPG Programmer”. I posed a question that involved the use of  APIs and prototypes, and I submitted my sample code. I got my question answered, but not before [...]]]></description>
			<content:encoded><![CDATA[<p>My recent <a class="aligncenter" style="display: inline !important;" title="RPG Forum" href="http://www.rpgiv.com/rpgivforum/view?SID=20100402091849520812&amp;NRL=16" target="_blank">experience</a> on the forum on Bob Cozzi&#8217;s RPGIV website underlined the fact that I am not in contention for the title of “World&#8217;s Best RPG Programmer”. I posed a question that involved the use of  APIs and prototypes, and I submitted my sample code. I got my question answered, but not before it was made very clear to me that my abilities as to APIs and prototyping were considerably below cutting edge.</p>
<p>How do you get to be a good programmer? You have to be intelligent, which can mean you have to know when to be as stupid as the computer. You have to be intolerant of errors. And you have to be willing to learn from your mistakes, as you will make thousands of them.</p>
<p>But beyond these basic qualities and attitudes, other circumstances may determine how deeply you will get into the more arcane aspects of your chosen programming language that will allow you to be among the “best”.</p>
<p>For one thing, your circumstances have to be such that you are exposed to advanced programming techniques. This will likely also be a function of your intellectual curiosity. But perhaps just as importantly, your circumstances have to be such that you will actually have a need for these techniques. You may never be in a position where you will need to access user spaces. While you may see some benefit to variable length fields, you may not see any burning need to start using them. And while much of the benefit of ILE is built around things like APIs and prototypes, it may well occur that your site simply does not need a wholesale conversion of code to make use of called procedures.</p>
<p>As it happened, my experience above came as a result of a need for them. Two-digit years are still used on my system. In calculating the maturity date of a 30-year loan written in 2010, I bumped up against the ILE default for two-digit date fields (1940 to 2039) and got an “invalid date” error when I attempted to generate 3/15/40 to represent 2040. To get around this, I decide to use an API I was aware of, CEESCEN, which allows you to float the 100 year range you want to use for the 100-year period in question. This is used in association with APIs CEEDAYS and CEEDATE to allow you to format dates in numerous different formats. (Google the API names for details.)</p>
<p>However, I was not familiar with how to set up the prototypes needed, and as a result I made some stupid mistakes that leaped out at the knowledgeable participants in the forum, especially Bob. But anyway, with some help, I got the prototypes and program calls to work.</p>
<p>But my learning things like these are in response to a specific need. I don&#8217;t have a burning need to learn all or even a substantial portion of the APIs available. I simply don&#8217;t need them. The fact is that I am getting paid to write production code, not specifically to “learn new things” . And the fact is also that I am not in a position where I can spend a lot of time outside the workplace learning new stuff, since family and other personal needs and circumstances have first claim on my time.</p>
<p>Other people, by reason of education, career choices, and the employers they happened to have, may have had open to them early in their careers opportunities to work on truly advanced concepts that I never was exposed to and likely never will be. Of course, their being smarter than me, not to mention better educated early on, would also make this more likely <img src='http://www.rpgandprogramming.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   My task being to maintain and upgrade code that was from the 1980&#8217;s and 1990&#8217;s in style, if not always in vintage, I will likely be kept busy doing that for the balance of my career. I like to think I&#8217;m good, but I&#8217;ll never be the best.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rpgandprogramming.com/2010/04/whos-the-best-programmer-around-not-me/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Adventure in Modernization</title>
		<link>http://www.rpgandprogramming.com/2010/01/adventure-in-modernization/</link>
		<comments>http://www.rpgandprogramming.com/2010/01/adventure-in-modernization/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 05:23:07 +0000</pubDate>
		<dc:creator>Curtis Barron</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[RPG]]></category>

		<category><![CDATA[RPG Freeform]]></category>

		<category><![CDATA[RPGIV]]></category>

		<guid isPermaLink="false">http://www.rpgandprogramming.com/?p=208</guid>
		<description><![CDATA[But sometimes, to old codgers like me, it&#8217;s difficult to know just how far to go. In previous posts I have written about my vaguely negative feelings about freeform RPG, and I have written very clearly about how I feel about IBM&#8217;s unwillingness to implement the MOVE instruction in freeform RPG, pointing out how this [...]]]></description>
			<content:encoded><![CDATA[<p style="margin-bottom: 0in;">But sometimes, to old codgers like me, it&#8217;s difficult to know just how far to go. In previous posts I have written about my vaguely negative feelings about freeform RPG, and I have written very clearly about how I feel about IBM&#8217;s unwillingness to implement the MOVE instruction in freeform RPG, pointing out how this can only hinder conversion of old code and diminish acceptance of the new RPG dialect.</p>
<p style="margin-bottom: 0in;">Case in point, a program I was working on today. I was writing code to implement formatting of a six-digit account number based upon the rightmost 6 digits of an 11-digit number. It was based upon some old code (the usual situation where I work), but the old code was hideous. The old program consisted of about 15 lines of MOVE and MOVEL statements. I said, this has got to go.</p>
<p style="margin-bottom: 0in;">So I contemplated the best way to do it. I could set up a data structure and put pieces of the account number into that, using EVALs or MOVEs,with dashes embedded as needed. But that didn&#8217;t seem quite elegant enough. I have been working harder to modernize my own code, so I finally broke it down to these two possibilities, as illustrated in this test program. The result I am aiming for is the number formatted as 01-234-5.</p>
<pre><code>
     H DFTACTGRP(*NO)   ACTGRP(*CALLER)
     D BACTNO          S             11  0 INZ(99999012345)
     D ACC6            S              8    INZ(*BLANKS)
     D NUM6            S              6  0 INZ(0)
     D ACCW            C                   '0  -   - '
     C/FREE
       EVALR ACC6 = %EDITW(%DEC(%SUBST(%EDITC(BACTNO:'X'):6:6):6:0):ACCW);
      /END-FREE
     C                   MOVE      BACTNO        NUM6
     C                   EVALR     ACC6 = %EDITW(NUM6:ACCW)
     C                   EVAL      *INLR= *ON</code></pre>
<p style="margin-bottom: 0in;">One way mixes the old and the new, with an old-fashioned MOVE to the smaller field, followed by a new-fangled %EDITW BIF using a predefined edit word. The other goes full-bore new age, with one grand set of embedded functions. To get the 11 digit number in string form so I can substring it, I use %EDITC with an X edit code, which does the conversion. Next, I  %SUBST (substring) the last six characters. I then use %DEC to convert those six characters back to numeric. Finally, I apply the %EDITW function to format those six digits as desired. (I would be interested in finding out about a shorter way to do it.)</p>
<p style="margin-bottom: 0in;">
<p style="margin-bottom: 0in;">But I have a problem with it. In an earlier post, I pointed out that the ability to create long, complex functions in freeform is not necessarily a virtue. The mere fact that I felt the need to explain it here indicates that I am not comfortable with it. The code is short, but I do not feel that it is clear. On the other hand, while the the two-line version using MOVE is short and sweet, and uses a BIF, it would force me to get out of freeform to use the MOVE; stylistically, that also seems wanting.</p>
<p style="margin-bottom: 0in;">
<p style="margin-bottom: 0in;">Since the thrust of my thinking is in trying to modernize the code so future generations of converted C programmers won&#8217;t be freaked out by the C in column 6, I am leaning toward the one-line version. But I don&#8217;t like it. It&#8217;s ugly.</p>
<p><strong></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rpgandprogramming.com/2010/01/adventure-in-modernization/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

