RPG : ILE Coding Workshop

About RPG : ILE Coding Workshop

An ever-growing list of lessons looking at various programming techniques using RPGLE and SQLRPGLE on the IBM i Power System.

Module Content

An ever-growing list of lessons looking at various programming techniques using RPGLE and SQLRPGLE on the IBM i Power System.

Example RPG for Beginners

MEMBERS ONLY

Read a flat file into a variable in a simple RPGLE program. In this example we will start with an old RPG3 format, modernize it to freeformat and compare styles!

Here is a little RPG program - just reading a file (table) and populating each file (row) into a Data Structure (Array). Capeeeche?

Yesterday I had to upgrade some codes from the 1990's It was column based RPG400 which basically reads a file, checks a field and updates it if certain conditions are met. Simple Right? So, let's grab that and upgrade it to use SQLRPGLE...

Ever coded in the wild west of old-school RPG, where GOTO tags and subroutines ruled with an iron fist? Yeah, me too! But what if I told you there's a smoother path forward? In this video, we're ditching those spaghetti-code relics and leveling up to modern RPGLE with clean, modular sub-procedures. We'll refactor real examples, slash complexity, and unlock code that's easier to read, test, and maintain (hopefully) without breaking a sweat. Stick around as we bridge the gap from legacy chaos to future-proof elegance. If you're an IBM i dev ready to evolve, hit that play button, like if you've battled a GOTO beast, and subscribe for more RPGLE magic. Let's code smarter, not harder!

Example RPG Code using SQL

MEMBERS ONLY

This lesson introduces learners to the fundamentals of creating a Customer Master Table on the IBM i platform using SQL. Designed for developers transitioning from traditional native I/O methods to modern SQL-based data management, the lesson walks through: 📋 Defining a normalized customer master schema 🛠️ Using SQL CREATE TABLE statements tailored for IBM i Db2 🔍 Exploring key fields like customer ID, name, address, contact info, and status flags 🔗 Understanding relationships with supporting tables (e.g., orders, addresses) 🧪 Sample queries to validate structure and retrieve customer data By the end of this lesson, learners will be equipped to design and implement a robust customer master table using SQL on IBM i, setting the foundation for scalable and maintainable enterprise applications.

Example RPG Code using IFS

MEMBERS ONLY

In computer science, pseudocode is a textual representation of an algorithm's steps, blending programming language conventions with informal, often self-explanatory notations for actions and conditions. While it shares characteristics with formal programming languages, pseudocode is designed for human comprehension, not for direct execution by machines.

Simple IBM i RPG program using SQL to read an IFS file into program variables for business logic processing.

QSYS2.IFS_WRITE is a system-provided function in IBM i (formerly known as AS/400 or iSeries) that allows you to write data to the Integrated File System (IFS). The IFS is the file system on IBM i that provides a UNIX-like file structure and allows access to files and directories.

RPG from the AS400 Days

MEMBERS ONLY

In today’s video, we’re diving into good old-fashioned column based RPG from the last century! Let's play with an internally defined print file and look at how the EXCEPT operation is used to print lines on that report. Whether you’re a beginner or a seasoned coder, I’ll break it down step-by-step to help you level up your skills. So, grab your coffee (preferably not the terrible store bought iced one I was choking down while recording this), fire up your code editor, and let’s get started!

Programming - IBM i Stored Procedures

MEMBERS ONLY

Learn how to write and run a simple SQL and RPGLE Stored Procedures on your IBM i System. This lesson walks you through the syntax, structure, and execution steps using real examples. You’ll use CREATE PROCEDURE, define parameters, and run your procedure with CALL.

To test an IBM i (AS/400) SQL stored procedure that returns two values, you need to understand how those values are returned. This lesson will show you the essentials, and show a simple SQL script to test any stored procedure on your IBM i System.

Let's dive into writing and testing our a simply SQL based stored procedure. We will create a file, write an SQL script to read that file, and define a stored proc to call that SQL and return the results. Sounds like fun!

An IBM i SQLRPGLE stored procedure is a user-defined program or routine stored in the IBM i system's database (DB2 for i) that can be called from a client application, another program, or a database interface to perform a specific task or set of operations. It encapsulates business logic or database operations, allowing for modularity, reusability, and improved performance in applications running on the IBM i platform.

An IBM i RPGLE stored procedure is a user-defined program or routine stored in the IBM i system's database (DB2 for i) that can be called from a client application, another program, or a database interface to perform a specific task or set of operations. This example uses DB2 native file IO for direct access from the RPG program.

Instructions for Retrieving and Rebuilding IBM i Stored Procedures: Stored procedures on IBM i (formerly AS/400) are reusable database routines that can be invoked via SQL. SQL stored procedures: Written entirely in SQL Procedural Language (PSM), compiled into an underlying ILE C program with embedded SQL. External stored procedures: Registered SQL wrappers around external programs or service programs (e.g., written in RPG, COBOL, CL, or C). The "source" here is typically the CREATE PROCEDURE statement that registers the procedure, not the underlying program's code.

Ready to learn?
{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
>