Back to: ILE RPG in Easy Bytes

Unit 1 explains general programming and computer-related concepts that you need to know as you begin to program in ILE RPG. The unit describes the sections of an ILE RPG IV program, and introduces the structure of an RPG program and basic syntax. It also illustrates how to write a simple file read/write program by using a procedural approach, as well as how to include comments within your programs as documentation. Finally, we’ll introduce program development tools and steps used to build RPG programs.
This course is a unit of the ILE RPG in Easy Bytes series, a complete introductory ILE RPG IV programming self-guided tutorial.
Prerequisites
This track is appropriate for programmers who need an introduction to the ILE RPG IV language syntax. No previous knowledge of RPG is required. Previous knowledge of another computer language may be helpful.
The free IBMi Program Development Tools course will also be useful.
How to Take the Course
The course is made up of a number of short lessons covering various aspects of the main course topic. If you are enrolled in the course, you will be able to view all its lessons. To view a lesson, select it from the menu below.
We recommend that you take the following approach to each lesson:
- Preview. Many of the lessons have one or more audio “previews” that you can use to familiarize yourself with the content of the lesson (or a section of the lesson). Most of these audio previews are less than five minutes long.
- Read. After you’ve listened to the audio for a section, study that section to get a more detailed understanding of the topic and and study some examples. When you are finished with a lesson, be sure to “Mark Complete” to let us know you’ve successfully completed it. As you complete each lesson, a progress bar will measure your passage through the course. Even after you’ve marked a course complete, you can still review it later.
- Review. Some of the lessons will have quiz questions to test your knowledge of the topic. You must pass the quiz with a score of 80% or better to move on. If you don’t understand why you answered incorrectly, you can “View Details” for an explanation, and then go back and review the course.
Tips
At any time, even if you are not viewing a lesson, you may use the Search function at the top of the page to search the lessons for a specific term. If you are enrolled in the lesson which contains the term, you may go directly to that lesson by selecting the appropriate search result. If you are not enrolled, when you select the search result, you will be invited to enroll. (Remember, though, you must take the units in order.)
At the end of each lesson is an outline of the course, with the completed lessons checked. You may revisit any completed lesson by selecting it, or you may go on to the next (unchecked) lesson.
At the end of each lesson, if you have any questions regarding that lesson, use the “Questions?” form to submit a question. We’ll try to answer your questions in a timely manner.
One-Time Payment
Members Only
Instead of paying for each unit individually, you may purchase a membership which will automatically enroll you at a discount in the entire “ILE RPG in Easy Bytes” series.
Introduction to Programming and RPG
To achieve this solution, the programmer generally uses a method called the program development cycle. This process, which summarizes the sequence of activities required in programming, includes the following steps: Define the problem.
Getting Started
Control options section—provides default options for the program Declarations section—identifies and defines the files, variables, and other data items a program is to use Main procedure section—details the processes, calculations, and procedures the program is to perform Subprocedure section—includes declarations and processes for optional distinct functions (subprocedures) of the RPG program that either the main procedure section or other subprocedures can execute once or many times Not every program includes each section. Within your source code, though, these sections must appear in the order above with all program lines in the same section grouped together. Additionally, within the declarations section, good programming style dictates that you group certain types of declarations (e.
To help you understand how to write such a program, let’s walk through the process of writing an RPG program to solve the following problem. You have a file, Customers, with records (rows) laid out as follows: This layout, called a record format, is stored in the Customers file itself when the file is created.
Next, you need to describe the processing steps to obtain the input and write the report. That is the purpose of the main procedure. The main procedure is the main body of your program—the part that outlines the processes, calculations, and procedures that your program executes.
1 and earlier) identify the sections of a program by using different kinds of lines, called fixed-format specifications. Fixed format means that the location of an entry within a program line is critical to the entry’s interpretation by the RPG compiler. Although you can write most modern programs by using free-format coding, which does not have positional restrictions, you may encounter fixed format when you are maintaining existing programs.