Part 2: Learn the Language

Part 1 got you connected and running Hello World. Part 2 teaches you the RPG language itself — the syntax, semantics, and patterns you’ll use every day.

This is the longest part of the tutorial, and intentionally so. The other parts assume you can read the code in front of you. Part 2 is where that fluency gets built.

Expect to spend several hours working through Part 2, spread across however many sessions suit you. You don’t have to do it linearly — if you’re in a hurry to start building, the minimum viable path is Chapters 1, 3, 5, and 6 (basics, procedures, embedded SQL, and the SQL-vs-RLA distinction). Come back for the rest when you hit something you don’t recognize.

What you’ll learn

The chapters cover:

  1. Free-Format Basics — variable declarations, data types, control flow
  2. Data Structuresdcl-ds and dot-notation fields
  3. Procedures — the modular building block of modern RPG
  4. Built-in Functions — the %functions every RPG program leans on
  5. Embedded SQL — set-based data access, the modern default for many tasks
  6. Choosing Between SQL and Native I/O — when to reach for SQL and when for Record Level Access
  7. Error Handling with MONITOR — keeping programs alive when things go wrong
  8. Date Math — the arithmetic RPG makes safe

What you’ll need

  • Completed Part 1 — you’re connected to PUB400, and your SUPPLIER, PRODUCT, and REORDCND tables exist
  • Roughly 20–30 minutes per chapter, though some are shorter

Ready? Start with Chapter 1: Free-Format Basics.


Table of contents