What are the different types of RPG programming?

RPG (Report Program Generator) has evolved significantly since its inception, leading to different versions and programming styles. Here's a breakdown of the main types of RPG programming you might encounter:

1. Historical RPG Versions:

  • RPG II: The earliest version, primarily used for report generation on older IBM systems. It had a very structured, column-oriented syntax.
  • RPG III: Introduced on the System/38, it brought significant advancements like structured programming constructs (IF-THEN-ELSE, DO loops), subroutines, and improved data handling.

2. Modern RPG (RPG IV/ILE RPG):

  • RPG IV (also known as ILE RPG): This is the most current and widely used version of RPG. It's characterized by:
    • Integrated Language Environment (ILE): Allows RPG programs to seamlessly interact with other ILE languages like COBOL and C, enabling code sharing and modular development.
    • Free-form syntax: Offers a more modern, less rigid syntax compared to earlier versions, making code easier to read and write.
    • Enhanced features: Includes support for modern programming concepts like data structures, subprocedures, and improved file handling.

3. RPG Programming Styles:

Within RPG IV, you'll find two distinct coding styles:

  • Traditional (Column-oriented): This style uses a fixed format with specific columns for different parts of the code. It's often seen in older RPG programs.
  • Free-form: This style provides a more flexible syntax, allowing you to write code in a less restrictive format. It's the preferred style for new RPG development due to its readability and maintainability.

Key Differences Summarized:

Feature RPG II/III RPG IV/ILE RPG
Syntax Column-oriented Free-form (and column-oriented for compatibility)
Structure Less structured More structured, with support for modern constructs
Integration Limited Integrated with other ILE languages
Features Basic report generation and data manipulation Extensive features for modern application development

 

Which type should you use?

  • For new development, RPG IV (ILE RPG) with free-form syntax is the recommended approach. It provides the most modern features, flexibility, and integration capabilities.
  • You might encounter older RPG II/III programs if you're working with legacy systems. Understanding these versions can be helpful for maintenance or migration purposes.

Important Notes:

  • While RPG has been traditionally associated with IBM midrange systems (AS400, IBM i), it's worth noting that there have been implementations of RPG for other platforms over the years.
  • RPG continues to evolve with ongoing updates and enhancements, ensuring its relevance in the IBM i ecosystem.

By understanding the different types of RPG programming, you can choose the most appropriate approach for your development needs and effectively work with RPG code in various IBM i environments.