What is the difference between RPG III, RPG IV, and RPG Free Format?

You're asking about the evolution of RPG, and it's a good question because the distinctions can be a bit confusing! Here's a breakdown of RPG III, RPG IV, and RPG Free Format:

RPG III

  • The Bridge: RPG III was a significant step up from the very early RPG versions. It introduced structured programming concepts (like IF-THEN-ELSE and DO loops), subroutines, and better data handling. This made RPG more powerful and flexible.
  • Still Column-Bound: However, RPG III still relied on a rigid, column-oriented syntax. You had to write code in specific columns on the screen, which could be cumbersome.
  • Legacy: You'll likely encounter RPG III programs if you work with older IBM i (AS400) systems. It's important to understand it for maintenance, but it's not used for new development.

RPG IV

  • Modernization: RPG IV (also known as ILE RPG) is the current, widely used version. It brought major changes:
    • Integrated Language Environment (ILE): This is a big deal! It allows RPG programs to work seamlessly with other ILE languages like COBOL and C. This enables code sharing and modular development.
    • Free-form Syntax: RPG IV introduced the option of free-form syntax, which we'll talk about more in a moment.
    • Enhanced Features: RPG IV has grown over the years with lots of improvements: data structures, subprocedures, better file handling, and more.

RPG Free Format

  • A Style within RPG IV: This is where the confusion often comes in. RPG Free Format is not a separate version of RPG. It's a coding style within RPG IV.
  • Flexibility: Free-form syntax lets you write RPG code in a more modern, less restrictive way. You're not tied to specific columns anymore. It's much more like languages you might be familiar with (C#, Python, etc.).
  • The Standard: For new RPG IV development, free-form is the preferred style. It makes code easier to read, write, and maintain.

Here's a table to summarize:

Feature RPG III RPG IV RPG Free Format
Version Older version Current version Coding style within RPG IV
Syntax Column-oriented Can be column-oriented or free-form Free-form only
ILE No Yes Yes (because it's RPG IV)
Use for new development No Yes Yes (recommended style)