RPG - not Role Playing Game

Education, Guest post, Programming, Technology Add comments

Google “RPG”, and your first hits will be about role playing games. But before there were Role Playing Games, there was RPG (Report Program Generator). This was the name of a computer programming language developed in the 1960’s by IBM. It was designed to generate reports (thus the name) in a terse, simple way. It used a cycle of input, process and output that was built into the language, so that you did not have to issue formal instructions to the computer to read the data files; you just described the file using fixed -format File specifications and Input specifications, entered the necessary Calculation specifications, then output the report in the format described in the Output specifications. Your humble correspondent, without a lick of Computer Science education, learned the language (RPG II) from the manager of a small RPG shop (in a class he held in his kitchen) well enough to write non-trivial programs in a matter of weeks (one class per week). It was easy.

Today, that language has become RPGIV, reflecting continuing enhancements that make it an extremely effective language for manipulating data. You will not likely use it to write an operating system or make pictures dance around on your screen, but computers used by tens of thousands of businesses have it as their base computer language, generating reports and entering and displaying data.

The future of RPG today, though, is in doubt, even though programs totaling billions of lines of code are running today on hundreds of thousands of machines. This is a reflection of the state of computer science today, as well as an example of the fact that, too often, what is often serviceable and effective is set aside.for what is fashionable.

In programming, the fashion today is centered around the Web, and languages associated with the Web - Java, Perl, Python, Ruby, C++, Visual Basic, Javascript, and so on - visually oriented languages, for the most part. Can RPG do the Web? Yes, but you have to jump through hoops to make it work. There is no facility in RPG that allows it to use HTML as effortlessly as its customary screen display files. And there are forms of RPG from IBM and ASNA that resemble VB and Java with their Windows displays, but they are by no means nearly as ubiquitous as VB. The kids learn VB or teach themselves Java or C- they do not learn RPG. It is not sexy; RPG is like its cousin COBOL - they are functional business languages, but Windows and Web processing have to be grafted onto them to work on Windows or the Web. RPG can be used in conjunction with Java on the AS/400; it works quite well to use Java for the user interface and RPG for the core business logic; but people tend want to forget the RPG and use something (anything) else.

In short, all RPG has going for it is that it works. It runs on a machine (the AS/400 or iSeries or Series i) with a database (DB2) incorporated into the hardware- no extra database software, though it can run SQL (and RPG can call and run SQL statements). The operating system (OS/400) makes even Linux seem to run flaky by comparison, without the need for systems administrators, and the machine it runs on seems to run forever. There is no such thing as the “blue screen of death”; at least, I haven’t seen one in almost 30 years. (For a long time, Microsoft ran its business on the AS/400, well into the latter half of the 1990’s.) RPG can call C++ and Java programs, and they can call RPG routines. It can also run HTML, with a little bit of extra effort.

Perhaps RPG and the AS/400 are too good at what they do. You can run 35-year old RPG programs unchanged using RPGIV. (Try running 1980’s vintage GWBASIC programs unchanged using VB. It likely will not be easy, perhaps not even possible.) Planned obsolescence is not implemented, as what seems to be true in the programs of Microsoft and other software producers. (And frankly, I believe IBM has done the right thing, purely on principle. Programming should be done to benefit those who pay for it to be done, not to entertain the programmer. Change the program if you need to improve or fix it, not just for the sake of change.)

RPG is being taught by very few schools; some community colleges have given up on their RPG-AS/400 courses due to lack of interest. Few new programmers are being educated. The RPG programming population is getting grayer and grayer. Though it can be used quite elegantly to produce powerful data-crunching programs, the young are not learning it. Crunching data is not entertaining. On RPG forums the topic of the future of RPG is argued quite violently; perhaps it will survive as long as people care about it. It would be a shame to see vast numbers of programs rewritten because people no longer care to use this highly functional language.

I find it difficult to believe computer science grads find it difficult to learn a language that I could learn in a very short time under less than ideal conditions. (I typed my first programs into the computer on 96-column punch cards and fed them into a card reader.) I have read opinions of obviously educated people who feel that the RPG logic cycle and the use of RPG “level break” handling (of processing when a designated field changes in value) is incredibly complex; I read about it in my RPG textbook, said “Hey - that’s pretty cool” and didn’t need to give it any further study. It is incomprehensible that these people find it difficult. Evidently, it’s sometimes easier to learn something when you know nothing about the topic than when you think you know something about it and your mind is halfway frozen shut.

I wish I had a solution; far wiser heads have yet to come up with a solid solution for the growing shortage of RPG programmers. But it would be such a waste if someone doesn’t.

 Guest Post - Curtis Barron

Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg
  • Fark
  • Furl
  • Reddit

5 Responses to “RPG - not Role Playing Game”

  1. Spencer Barron Says:

    I think your right about the RPG language not being the ’sexy’ choice. It’s probably a great language but in the end, it just doesn’t play well with others. These days, for wide acceptance, it seems you also need some flashing doodads on the screen.

    Kids these days will never embrace RPG unless something changes? What would RPG V look like? Could the output be changed into a format that would play well on the web? Besides stablity, what are the advantages for using RPG when compared to the other more popular options?

  2. david Says:

    While RPG might not be the sexiest language in the world … it’s not dead by a long shot. It’s certainly a workhorse language that is extraordinarily suited for solving back office business application tasks. An RPG programmer doesn’t have to worry about how he hooks up to the database … it’s all built into the language. All he/she has to do is worry about solving the business problem.

    Recent advances in the language have given it some pretty nice changes … free form code (as apposed to column based) and a very powerful Eclipse based editor (WDSC — Websphere Development Studio Client for iSeries, or RDi — Rational Developer for System i), just to name a few.

    There’s a quite active System i community … part of which I run. The RPG400-L mailing list is very active.

  3. Curtis Barron Says:

    I think part of the problem is that RPG existed to fill a particular need; a programming language that rather tersely operated on data. The first people to learn it were not kids, but business people. My first employer had an accounting manager who fancied himself an RPG
    programmer. You didn’t need to be on the road to a college degree to learn it. Now, the road is much more formal. Schools push what seems to be the most marketable approaches- others get pushed to the side of the road. A popular language like C++ might be stressed instead of a teaching language like Pascal or Oberon-2 (which is used to some degree
    in Europe.)

    Programming for businesses and scientific applications is not the most entertaining form of programming, but one could make an argument that it is the most useful. My own opinion (rather unpopular, I’ll admit) is
    that writing video games is a perversion of programming. And most kids these days are not oriented toward that which is useful, but rather that which is amusing or fun.

    RPG can be used in conjunction with HTML. However, RPG is designed to communicate with a video screen through DDS (Data Description Specifications), which format the screen, defining constant fields such as text along with input and output(display) fields. HTML is a keyword
    that can be used in DDS; but you must very carefully define the data and HTML tags in the DDS specifications. It is a tedious process. With the normal “green screen”, you use a utility called SDA (Screen Design Aid)
    to make screen design easier. There is no utility to create HTML in a similar fashion. That is a handicap.

    Some RPGers want IBM to put into RPG the facility to handle HTML as naturally as it does DDS, which creates an RPG “WORKSTN” file. IBM has been pushing Java hard, and apparently they do not see the need to give RPG that capability. Several years ago, IBM created a measure of
    ill-will by putting ads in the trade papers that implied that if you didn’t drop RPG and learn Java, you would end up flipping hamburgers at McDonalds. More recently, they have been enhancing RPG more, but they still do not provide the “native” ability to handle HTML.Outsiders have attempted to provide packages to enable Web development, but they are usually kludgy addons.

    You can now write RPG calculations in a freeform manner, which makes some people happier than using fixed spots in a program line to put operation codes and calculation factors. Maybe that will be less of a turnoff to our budding Basic and Java programmers.

    The value of RPG is that it manages and manipulate data in a firm, straightfoward, terse way. It will never be used to write an operating system or a video game, but it manipulates file data, including data going to and from “screen” files, very elegantly.

    I thought I’d illustrate the differences between languages by showing how Java and RPG/400 (the dialect between RPGIII and RPGIV) program the display of the verses to “99 Bottles of Beer”: (from http://99-bottles-of-beer.net/ )

    // java version of 99 bottles of beer on the wall
    // 1995 Sean Russell (ser)

    class bottles
    {
    public static void main(String args[])
    {
    String s = “s”;
    for (int beers=99; beers>-1;)
    {
    System.out.print(beers + ” bottle” + s + ” of beer on the wall, “);
    System.out.println(beers + ” bottle” + s + ” of beer, “);
    if (beers==0)
    {
    System.out.print(”Go to the store, buy some more, “);
    System.out.println(”99 bottles of beer on the wall.\n”);
    System.exit(0);
    }
    else
    System.out.print(”Take one down, pass it around, “);
    s = (–beers == 1)?”":”s”;
    System.out.println(beers + ” bottle” + s + ” of beer on the wall.\n”);
    }
    }
    }

    H*
    H* RPG/400 VERSION OF THE BOTTLES PROGRAM *
    H*
    FSCREEN O F 80 WORKSTN
    C MOVE 100 X 30
    C** COUNT DOWN FROM 100 TO 0
    C** ONE BUG IS THAT IT DOESN’T SAY “BOTTLE” WHEN THERE’S ONLY 1
    (CURT BARRON)
    C X DOWGE0
    C EXCPT
    C SUB 1 X
    C END
    C SETON LR
    OSCREEN E
    O X 3
    O 26 ‘BOTTLES OF BEER ON THE’
    O 31 ‘WALL,’
    O X 36
    O 53 ‘BOTTLES OF BEER’
    O E
    O 22 ‘TAKE ONE DOWN AND PASS’
    O 32 ‘IT AROUND’

    Once you understand that DOWGE stands for “Do while greater than or
    equal to” , the programming should be clear.

  4. Spencer Barron Says:

    It doesn’t look like the RPG Code handles the same code as the java when it gets to the C++ if statement, no going to the store to buy some more.

    That Java looks suspiciously like C++.

    Is there an advantage of using SQL to manipulate a database over RPG? If not in power, perhaps in cost, ease of use?

    I think having the user base is huge. Everything else follows. C++ probably gets its support in a large way from the fact that it is a video game language.
    Video gaming is a bigger industry than the film industry…and not as sexy. But lots of progammers got interested in progamming trying to break into gaming. That’s the soul reason I’d would have ever picked up a programming guide as a kid. That and the thought of having a computer do my homework.
    Later in life, programmers realize they have to make a living. C++ isn’t that bad, it’s just tedious especially when it comes to the output. On the other hand, there is lots of code in C++ already written and readily vailable to do just about anything you need it to do.

    I can see why IBM would push Java but it seems a pretty big mistake to not put more effort into migrating your previous product in a fashion that would keep not just your user base but the programmers and proponents of your
    sytem interested.

    I know from experience that employees in the end will most likely be the ones who make the final recommendation on whether a technical product is worth a swith or worth the money. If you don’t connect with them, you’re lost.

  5. Curtis Barron Says:

    I saw the thing about “buying some more”, too, but it was after midnight when I finished the reply and I was in no mood to make program modifications :)

    RPG people who have worked with SQL within and outside RPG seem to believe that SQL handles set manipulation over a file (a SELECT statement of all the data in the file that fits the specified criteria) better than native RPG file access, but RPG grabs individual records more efficiently than SQL. From my experience, I would tend to agree.

    I think Java and C++ came from the same roots. The creators of Java tried to make C++ better. C++ is object orientation grafted onto C, and it shows. You might remember my comment in my first post about the 1000-page “Introductory” C++ textbooks. I read about an IT director who said it took over 2 years to train a C++ programmer to write production programs- about as long as it took to train astronauts.

Leave a Reply

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in