ArticleslgStudy

computer science

IBM RPG II

IBM RPG II is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand IBM RPG II rather than just read about it. In short: RPG II is a very early and popular version of the IBM RPG programming language. It was developed in the late 1960s and designed to work on the smallest IBM systems of the time such as the IBM 1130, IBM System/3, System/32, System/34, System/36.

IBM RPG II — main illustration
IBM RPG II — illustration

Key takeaways

  • IBM RPG II belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect IBM RPG II to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of IBM RPG II from memory before moving on to harder problems.

Reference excerpt

RPG II is a very early and popular version of the IBM RPG programming language. It was developed in the late 1960s and designed to work on the smallest IBM systems of the time such as the IBM 1130, IBM System/3, System/32, System/34, System/36. It was also available for the System/370, The Singer System 10, Sperry Univac 90/25, 90/30, 90/40, System 80, 1100 mainframe series and the Wang VS Series. ICL produced versions for its ICL 2903 system and for VME/K; and Burroughs Corporation produced an RPG II compiler with database extensions for its B1700 series of computers. Digital Equipment Corporation had their own implementation named VAX RPG II for VAX/VMS systems. An enhanced version RPG III appeared in 1978. It has a number of unusual features, including: an implied processing loop; and that it is a fixed-format programming language, so that programs are difficult to read without a special debugging template.

Features RPG II is a fixed-format programming language, which means that code must be placed in exact column locations in order to generate correct results. There are eight different specification types, and separate coding forms are used to write each, and a special debugging template used as an aid to read program printouts. Every RPG II program executes within an implied loop, the program cycle, which applies the program successively to every record of a file - this is documented via a "Logic Flow" diagram on the debugging template. Each record (individual punched card) would be compared to each line in the program, which would act upon the record, or not, based upon whether that line had an "indicator" turned "on" or "off" — from a set of logical variables numbered 01–99 for user-defined purposes, or other smaller sets based upon record, field, or report processing functions. Special variables such as UDATE, UYEAR, PAGE, and so forth, are filled when the program begins or when page overflow occurs, even though there is no explicit instruction for these activities. Total calculations and output are done at "total time," after the detail cycle when L1/LR has been set on by fixed logic. The concept of RPG's program cycle fitted neatly with a cyclical machine that read cards, summarised their contents and prints a result, rather like a tabulating machine. The language was extended to handle other input and output devices and provides a fast and efficient method of programming. Devices such as the workstation (WORKSTN), the keyboard (KEYBORD), or the console (CONSOLE) do not have a fixed number of records at the beginning of the job and therefore, in order to incorporate the fixed-logic RPG "Last Record" cycle, the LR indicator can be set on with a SETON instruction. LR cannot be set off. RPG II did not evolve much from the 1977 implementation on the System/34 to 2000 when the Advanced/36 was discontinued from marketing. Changes that were made from the 1970s version included the IFEQ/IFNE/IFGT/IFGE/IFLT/IFLE and END grouping. Also, the call/parm to be able to call external subroutines. Another change was that for internal subroutines, you no longer had to put SR in columns 7 and 8 of the C (calculation) specs. Third-party providers sold more than 200 different assembler subroutines that could be used by System/36 and Advanced/36 programmers to exceed RPG II limitations. Some of the limitations of RPG II on the System/3, 32, 34 and 36 including the Advanced/36 was the 64K limit and the number of files you could have in a program. So if you had a lot of programming lines or had large arrays, it was easy to exceed the 64,000 bytes of object code. However, RPG II running on the AS/400 and its follow on iseries and IBM i (those running OS/400 or i5/OS in what is called S/36E (execution environment)) those limits (the 64K bytes and the number of files) were either greatly expanded or removed.

RPGII specifications In the System/36 implementation of RPG II, there are eight different specification (spec) types, that is a fixed-format line of text, 80 characters (bytes) in length, derived from the original use of punched card input for earlier IBM systems, like the System/3. Like specifications were grouped together, and each type was required to be in a specific order: U, T, H, F, E, L, I, C AND O. Specification codes appear in column 6 of an RPG-II specification:

Operation codes appear in columns 28–32 of an RPG-II calculation specification.

CALL/PARM was added to RPG II with Release 6.0 (also known as the VASP). CHAIN retrieves the record in the indexed file named in Factor 2 that matches the exact key specified by the value in Factor 1. SETLL causes the index pointer for the file named in Factor 2 to be positioned at the location specified by the value in Factor 1. SORTA causes the named array to be sorted in place; that is, the elements appear in order. Z-SUB calculates Factor 2 with opposite sign and moved to result field. XFOOT causes an array to be summed and the result moved to result field. MVR must follow a DIV operation. The integer remainder of the DIV operation is placed in the result field. MVR following the DIV operation for "56 divided by 3" would place the value 2 in the result field.

Indicators Indicators are either 'set' or not, they are "flags" or boolean data types.

… excerpt ends here. Continue reading the full article.

Illustrations

IBM RPG II: IBM System/3 model 10
IBM System/3 model 10

Worked examples

Example 1 — a first encounter with IBM RPG II

Start with the simplest possible case. Write down what IBM RPG II claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to IBM RPG II before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about IBM RPG II ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of IBM RPG II

In research
IBM RPG II appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses IBM RPG II in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
IBM RPG II is common in secondary-school and first-year university syllabi. It links to neighbouring topics High-level programming languages, IBM software, Procedural programming languages, so understanding it makes those chapters shorter.
In everyday life
Look for IBM RPG II outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “IBM RPG II” →

How to study IBM RPG II in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what IBM RPG II means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain IBM RPG II out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is IBM RPG II in simple terms?

RPG II is a very early and popular version of the IBM RPG programming language. It was developed in the late 1960s and designed to work on the smallest IBM systems of the time such as the IBM 1130, IBM System/3, System/32, System/34, System/36.

Why does IBM RPG II matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study IBM RPG II?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on IBM RPG II.

Tags

  • High-level programming languages
  • IBM software
  • Procedural programming languages
  • Programming languages created in the 1960s

Keep exploring