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:
- Free-Format Basics — variable declarations, data types, control flow
- Data Structures —
dcl-dsand dot-notation fields - Procedures — the modular building block of modern RPG
- Built-in Functions — the
%functionsevery RPG program leans on - Embedded SQL — set-based data access, the modern default for many tasks
- Choosing Between SQL and Native I/O — when to reach for SQL and when for Record Level Access
- Error Handling with MONITOR — keeping programs alive when things go wrong
- 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.