About Learn to program RPG for beginners
Come with me while we talk about the IBM RPG (Report Program Generator) language. We will step through some basics of the language, discuss some history and even get our hands dirty with a little programming. It's an old language and has evolved a lot over the years -- modern RPG is unrecognizable from the old column based code from the 1980's. Let's dive in and start at the beggining.
This will be fun!
Honest ;)
Module Content
Come with me while we talk about the IBM RPG (Report Program Generator) language. We will step through some basics of the language, discuss some history and even get our hands dirty with a little programming. It's an old language and has evolved a lot over the years -- modern RPG is unrecognizable from the old column based code from the 1980's. Let's dive in and start at the beggining. This will be fun! Honest ;)
IBM i RPG - So much more than a Report Program Generator
MEMBERS ONLY
General info about RPG - This chapter introduces you to general information about RPG source code.
Variables and procedures - This chapter introduces you to defining constants, variables and prototypes.
Introduction to Files / Tables - This chapter introduces you to using files with RPG
Display files - This chapter introduces you to using display files, also called "workstation files"
Solutions to RPG exercises - every question has an answer
Learning to code is most effective if you start with some clean coding standards. So let's start building those foundations properly with advice for RPG, RPG400 and modern ILE RPG programmers.
IBM i RPGLE Programming Language - Declarations
MEMBERS ONLY
Welcome to a tasty lesson on using DCL-C in IBM i RPGLE, brought to you by the one and only Nick Litten. We’re cooking up some code in CodeSlice Pizzeria, where constants keep our pizza orders as stable as a well-baked crust. Let’s dive in!
This lesson dives into the DCL-S statement in IBM i RPGLE. DCL-S is your go-to for declaring standalone variables, the ingredients that make your program as flexible as a pizza dough toss. We’ll cover every variation of DCL-S with a pizza-ordering example that’s hotter than a fresh pie. Let’s get started!
This lesson serves up another slice of programming goodness at CodeSlice Pizzeria. Come with me and let's dive into the DCL-DS statement in IBM i RPGLE. We’re building a pizza order with data structures to keep things as organized as a perfectly sliced pie. Let’s get coding!
Welcome to CodeSlice Pizzeria’s file-handling extravaganza! This lesson, dives into the DCL-F statement in IBM i RPGLE. DCL-F is your ticket to managing files like pizza order slips, logs, and receipts with the precision of a master chef. We’ll explore file declarations with a pizza-ordering example and cover all the key variations. Grab a slice and let’s dig in!
IBM i RPGLE Programming Language - Operation Codes
MEMBERS ONLY
These RPG operation Codes handle mathematical calculations - ADD
These RPG operation Codes handle mathematical calculations - DIV (Divide)
These RPG operation Codes handle mathematical calculations - MULT (Multiply)
These RPG operation Codes handle mathematical calculations - SQRT (Square Root)
These RPG operation Codes handle mathematical calculations - SUB (Subtract)
These RPG operation Codes handle mathematical calculations - Z-ADD (Zero and Add)
These RPG operation Codes handle mathematical calculations - Z-SUB (Zero and Subtract)
These RPG operation Codes handle ARRAY operations - LOOKUP (Look Up a Table or Array Element)
These RPG operation Codes handle mathematical calculations - MULT (Multiply)
These RPG operation Codes handle RPG Array Operations - XFOOT (Summing the Elements of an Array)
These RPG operation Codes handle RPG Bit Operations - BITOFF (Set Bits Off)
These RPG operation Codes handle RPG Bit Operations - BITON (Set Bits On)
These RPG operation Codes handle RPG Bit Operations - TESTB (Test Bit)
These RPG operation Codes handle RPG Branching Operations - CABxx (Compare and Branch)
These RPG operation Codes handle RPG Branching Operations - CASxx (Conditionally Invoke Subroutine)
These RPG operation Codes handle RPG Bit Operations - TESTB (Test Bit)
These RPG operation Codes handle RPG Branching Operations - GOTO (Go to)
These RPG operation Codes handle RPG Branching Operations - ITER (Iterate)
These RPG operation Codes handle RPG Branching Operations - LEAVE (Leave a Do/For Group)
These RPG operation Codes handle RPG Branching Operations - TAG (Tag)
These RPG operation Codes handle RPG Call Operations - CALL (Call a Program)
These RPG operation Codes handle RPG Call Operations - CALLB (Call a Bound Procedure)
These RPG operation Codes handle RPG Call Operations - CALLP (Call a Prototyped Procedure or Program)
These RPG operation Codes handle RPG Call Operations - PARM (Identify Parameters)
These RPG operation Codes handle RPG Call Operations - CALLP (Call a Prototyped Procedure or Program)
These RPG operation Codes handle RPG Call Operations - PARM (Identify Parameters)
These RPG operation Codes handle RPG Call Operations - PLIST (Identify a Parameter List)
Getting Started with RPG Free-Form Programming
MEMBERS ONLY
Getting Started with IBM i RPG: For those who are just exploring the wonderful RPG language - there are lots of wonderful *FREE* guides out there in internet land. I've pulled them together, re-written, updated, freshened and tweaked them for easy reference
Welcome to your first deep dive into the world of IBM i RPG programming, where variables and procedures are the building blocks of clean, modern code. In this lesson, we’ll strip away the mystery behind RPG declarations and show you how to wield them like a pro. Whether you're defining simple constants, crafting structured data with DCL-DS, or modularizing your logic with procedures, you'll learn how to write code that's readable, reusable, and ready for the real world. Think of this as your RPG toolkit: once you master these essentials, the rest of your programming journey becomes a whole lot smoother, and dare we say, more fun. Let’s get started!
Welcome to the heart of RPG programming where variables and procedures turn static code into dynamic, reusable logic. In this lesson, we’ll explore how to declare and use variables with clarity and precision, from simple scalars to structured data definitions. Then we’ll dive into procedures, the modular powerhouses that help you write cleaner, more maintainable programs. Whether you're just starting out or brushing up on modern RPG techniques, this is your launchpad to writing smarter, more efficient IBM i code. Let’s roll up our sleeves and start building!
Welcome to the world of display files where your RPG programs finally get a face! In this lesson, we’ll explore how workstation files (aka display files) allow RPG applications to interact with users through screens, menus, and prompts. Whether you're building a simple data entry form or a full-blown interactive interface, display files are your gateway to user-friendly IBM i applications. We’ll break down how to define them, link them to your RPG logic, and handle input/output operations with flair. Ready to make your RPG code talk to the outside world? Let’s light up the screen.
In this lesson, we’ll take a high-level tour of RPGLE (Report Program Generator Language Enhanced), the evolved form of RPG that powers robust business applications on IBM i systems. You’ll learn how RPGLE blends legacy reliability with contemporary syntax, making it easier to write clean, modular, and maintainable code. We’ll touch on free-form layout, data declarations, procedures, and the tools that make RPGLE a joy to work with in today’s development environments. Whether you're coming from fixed-format RPG or just starting fresh, this overview sets the stage for everything that follows. Let’s dive in and decode the magic behind RPGLE.
Writing RPG ILE Programs on your IBM Power System
MEMBERS ONLY
Let's have a look at the most simple version of an old RPG program. A 2 line HELLO WORLD example, written in column based RPG400 (aka RPG3) which will simply send a message to the screen. We can do this using SEU, Source Entry Utility, and integrated text editor on your IBM i Power System - which has remained unchanged for over 20 years :)
Welcome back to part 2 of "programming like an AS400 Noob" ;) In this video we can look at our original simple HELLO WORLD code sample and uplift it to RPGLE format. We can have a quick spin through the PDM development environment and look at some command line tricks.
Yep. You guessed it! In this thrilling episode we are going to take that old column based RPGLE code and set it free. Take our first tentative steps into the world of free format RPG code.
In this, the penultimate episode of "playing with smelly old RPG code" we take the final step into the world of modern RPG code layout. Introducing the **FREE command line, we finally tell the IBM i Compiler that we are not messing about.
Welcome back to final episode of this "RPG for complete noobies" series. Here we will poke around in some modern RPG code, and use Microsoft code editor (Visual Studio Code) to edit the RPG in real time on our IBM i Power System. How does VSCODE know about RPG? By using the marvelous CODE4I plugin of course!
RPG 101 Ep6: Tweaking Hello World to Make It a Bit More Fancy Let's upgrade this super simple HELLO WORLD program to add some more standards and functions In this final flourish of the RPG 101 series, we take our humble Hello World program and give it a stylish upgrade. This lesson shows how to add a touch of polish to your RPGLE code—introducing better formatting, cleaner output, and a few best practices that elevate your code from functional to fabulous.
Beginners Overview of an RPG400 File Update Program
MEMBERS ONLY
Come with me, while I play with someone else's old RPG400 code which performs a *PF file update and allows paging forward and backward through the data... then we will refactor that old ISERIES COLUMN BASED RPG to modern IBM i RPG ILE Freeformat and test it. Assuming that works... then we will upgrade the *PF to an *SQL TABLE and prove that it works with the program without needing any recompiles. Sounds like a fun Friday evening ;)
Are you a novice IBM RPG programmer, or perhaps just a techno junkie who likes to learn about new programming languages? Then this breakdown of some other programmers old RPG400 file update program might be something that you will enjoy. I hope you do. I get strange enjoyment from playing with chunks of code like this... and figuring out what makes them tick.
Let's take a deep dive into this RPG400 program to try and figure out how it works. This will mean looking at the file and display setting to understand the relationship with the RPG code. We are going through it line by line to understand it, compile it and test it. After that... then we can look at upgrading the code to modern FREE FORMAT RPG and upgrade the physical file to an SQL TABLE. Put on your dive mask... and dive in!
Time to dive into the existing RPG400 (Column Based Old Style RPG) and set it FREE. This means using Visual Studio Code, and the Code4i plugin, to automatically upgrade the old legacy code style to modern free format RPG ILE. This does a pretty good job easily upgrading 90% of the code - so come with me while I walk through the code base and manually fix the few lines it couldnt automatically handle. SPOILER ALERT - don't laugh at me when I make RPG conversion mistakes. They are deliberate. Honest ;)
Come with me, while we trawl through this old code and update to a newer style of subroutine - the much lauded RPG SUB PROCEDURE
Let's convert our physical file to an SQL Table two ways, once using my toolkit command from PROJEX4i, or for those that don't want to download and install the toolkit onto their IBM i System, we will also use IBM i Access Client Solutions itself. We will check the file record format level ID to prove that the new TABLE looks just like the old PF and all existing RPG code will simply run over the new TABLE without needing any recompiles.
Write Clean Code
MEMBERS ONLY
Debugging RPG Programs on IBM i: A Beginner’s Guide to Squashing Bugs Whether you’re slinging legacy RPG or rocking the modern Free Format vibe on the IBM i Power System, one thing’s for sure: bugs happen. Those sneaky little gremlins can turn your perfectly planned subfile into a head-scratcher. But fear not—debugging RPG programs is a skill you can master, and I’m here to walk you through the basics. Let’s fire up the IBM i debugger and get those programs back on track!
