RPG Tutorial
I began learning RPG in 1973 at the same time I began learning COBOL. I had the good fortune of becoming employed by the college I was attending on a work-study program, so the same people who were teaching the courses were available to me virtually all day, everyday. When I first started working there, there were two programmers teaching and maintaining systems for the school. One of the programmers wrote only in RPG and the other wrote only in COBOL. Each programmer tried to convince me that his own language specialty was the one I should concentrate on. Consequently, I came to appreciate both languages for their strengths.
Most of my career I have been writing COBOL programs. The last time I wrote any significant RPG (by which I mean code that went into production) was in 1982. Still, I think RPG is a simple but powerful problem solving tool that shouldn't be overlooked or dismissed simply because it is viewed by the majority of computer professionals as a "minicomputer" language.
A visitor to my Hercules' site lamented that there were few RPG textbooks available. I can add from personal knowledge that the few which are available are prohibitively expensive, as are most computer texts. Another fact is that if you intend to write RPG to compile with the RPG compiler we have available with MVT, you will find that most texts available concentrate on RPG II, RPG III, and RPG IV (or RPG/400). These variants contain extensions to RPG I (which I often refer to as RPG with no number) that are not recognized or supported by the MVT RPG compiler.
So, my goal in writing this tutorial was to provide enough basic information to allow someone who had little or no RPG experience to begin writing RPG programs, specifically with the MVT RPG compiler running under Hercules as the target system. I have included a series of annotated RPG programs, each emphasizing a specific concept. Along with the page containing the annotated program source there is a link with the compiled program and output of the program's execution. There is also an archive containing the jobstream with the source and the data files required for the program. Beginning with the third program, the data files updated by each program are necessary for the successive programs.
If you are interested in learning about RPG, I hope these pages are useful to you. From my own experience, if you have a solid understanding of RPG and later need to advance to RPG II, RPG III, or RPG IV, you will find the transition almost painless.
This page was last updated on January 17, 2015.