Quick Summary — Using IBM Bob Premium Package for i (PPI), IBM i Developer Mode, and the built-in RPG Modernization workflow, I modernized a native fixed-format RPG report program with a program-described printer file into free-format RPGLE with an externally described DDS printer file. The workflow handled the conversion, compilation, and error correction while keeping the original source unchanged.

The Program: A Native RPG Program with a Program-Described Printer File

The program I selected for modernization was STUDRPT. It reads student records from the STUDENP physical file and prints them using a program-described printer file.

The printer file layout, including field positions, spacing, column headings, and print formats, is defined directly in the RPG source using O-specs. Since free-format RPGLE does not support O-specs, these definitions must first be converted into an external DDS printer file.

IBM Bob's RPG Modernization workflow handles the full conversion — from externalizing a program-described printer file into DDS through to modernizing the RPG program to free-format.

The RPG Modernization Workflow: What It Does and How It Starts

IBM Bob with IBM i Developer Mode provides a built-in RPG Modernization workflow. IBM i Developer Mode must be active before starting the workflow, as it enables IBM Bob to connect directly to the IBM i system, access source members, execute CL commands, run SQL against Db2 for i, and compile programs.

When I triggered the RPG Modernization workflow, IBM Bob detected that STUDRPT.rpgle was already open in the editor and offered to use it as the input. After I confirmed, it read the source, identified the program type as RPG IV fixed format, and started the preparation steps.

STUDRPT.rpgle open in VS Code with O-spec lines visible starting at line 31, and the IBM Bob RPG Modernization workflow panel on the right
STUDRPT.rpgle open in the editor with the RPG Modernization workflow panel. IBM i Developer Mode is active.

The workflow then created a temporary working copy named STUDRPT_T.RPGLE in the same library. All intermediate changes were made to this copy, while the final free-format program was saved as a new member named STUDR_FREE.RPGLE. The original STUDRPT.rpgle remained untouched throughout the process.

Step 1: Pre-Conversion Compilation

Before making any source changes, IBM Bob provided the compilation option to establish a baseline. This helps identify any existing compilation errors before modernization and distinguish them from issues introduced during conversion.

IBM Bob showing the Pre-Conversion Compilation step with the temp member STUDRPT_T created, output location set to STUDR_FREE.RPGLE, and the option to compile or skip before converting
Pre-Conversion Compilation — temp copy STUDRPT_T created, output set to STUDR_FREE.RPGLE, compile option presented.

IBM Bob used get_compile_actions to identify the appropriate compile command and provided CRTBNDRPG to compile the temporary copy. After compilation, it queried QSYS2.OBJECT_STATISTICS to verify that the STUDLIB/STUDRPT_T (*PGM) program object was created.

Pre-conversion compilation passed. STUDLIB/STUDRPT_T (*PGM) created. Severity 00. The source was clean and ready for conversion.

Step 2: Detecting I-Specs and O-Specs

Next, the workflow analyzed the source to identify program-described I-specs and O-specs that might need to be externalized before converting the program to free-format RPGLE. It used separate subagents for each detection step.

IBM Bob showing the I-spec and O-spec detection results — STUDENP confirmed as externally described with no I-specs found, and STUDRPTR printer file confirmed as program-described with O-specs present starting at line 31
I-spec and O-spec detection results — no I-specs, O-specs found at line 31.

I-Spec Detection

The I-spec detection subagent checked the source for program-described input specifications. It found that the STUDENP database file was already externally described through DDS, as indicated by the E in column 22 of its F-spec. No I-specs were present in the source.

I-Spec Detection result: hasISpecs: false and hasCycleLogic: false. The I-spec externalization step was automatically skipped.

O-Spec Detection

The O-spec detection subagent checked the source for program-described output specifications. It identified the OSTUDRPTR printer file at line 31 and confirmed that it was program-described. Based on this finding, the workflow proceeded to the O-spec externalization step.

Step 3: Externalizing O-Specs to a DDS Printer File

The workflow started a separate subtask for O-spec conversion. Before analyzing the source, IBM Bob loaded two IBM i Skills to guide the conversion.

The subtask also maintained a todo list to track the conversion steps, from analyzing the source and generating the DDS printer file to compiling it, updating the RPG program, and verifying the final changes.

IBM Bob O-Spec Externalization subtask showing the skills rpg-pgmdb-conversion and rpg-ospec-conversion being loaded, and the full todo list for the subtask visible in the right panel
O-Spec Externalization subtask — two skills loaded, todo list tracking the full conversion plan.

Generating the External DDS Printer File

IBM Bob generated the DDS printer file STUDRPTR.PRTF in STUDLIB/QDDSSRC. The 37 O-spec lines were converted into DDS record formats.

The three HEAD print groups were converted into separate record formats: HEAD1, HEAD2, and HEAD3. The detail and footer formats were retained as DTL and END. IBM Bob also translated the field positions and spacing specifications into the corresponding DDS keywords.

STUDRPTR.PRTF DDS source open in the editor with all record formats visible, and the IBM Bob panel showing the CRTPRTF command executed successfully with CPC7301 confirming the file was created in STUDLIB
STUDRPTR.PRTF open in the editor. Right panel: CRTPRTF succeeded — CPC7301: File STUDRPTR created in library STUDLIB.

The printer file was then compiled using CRTPRTF. IBM i confirmed its successful creation with message CPC7301: File STUDRPTR created in library STUDLIB.

Updating the RPG Source

After generating the DDS printer file, IBM Bob made the following changes to the temporary RPG source:

  1. Updated the printer file F-spec from program-described (F) to externally described (E).
  2. Changed the overflow indicator from OFLIND(*INOF) to OFLIND(*IN01).
  3. Replaced the EXCEPT operations with corresponding WRITE operations, referencing the new DDS record formats.
  4. Removed all 37 O-spec lines from the RPG source.
Bob Edit Preview diff view of STUDRPT_T.RPGLE showing the F-spec updated from F to E with OFLIND(*IN01), EXCEPT opcodes replaced with WRITE opcodes, and all 37 O-spec lines highlighted in red indicating removal
Source diff — F-spec updated to externally described, EXCEPT replaced with WRITE, 37 O-spec lines removed.
Before — program-described printer file
- FSTUDRPTR  O    F  132  PRINTER OFLIND(*INOF)
- C                   EXCEPT    HEAD
- C   OF              EXCEPT    HEAD
- C                   EXCEPT    DTL
- C                   EXCEPT    END
- OSTUDRPTR  E            HEAD     1 01
- O                               10 'Student ID'
- ... 30 more O-spec lines
After — externally described printer file
+ FSTUDRPTR  O    E       PRINTER OFLIND(*IN01)
+ C                   WRITE     HEAD
+ C   *IN01           WRITE     HEAD
+ C                   WRITE     DTL
+ C                   WRITE     END
+
+ // O-specs removed. Layout now in STUDRPTR.PRTF.

Compile Error and Automatic Correction

After applying these changes, IBM Bob compiled the updated RPG program. The first attempt failed because the STUEML (email) field length in the generated DDS did not match the field definition expected by the RPG program.

In O-specs, the field length is implied by its ending position, whereas DDS requires an explicit field length. The generated definition needed to be corrected to match the program's field definition.

IBM Bob identified the mismatch, corrected the DDS field length, and recompiled the printer file and RPG program.

Attempt 1 failed — STUEML field length mismatch: The STUEML (email) field length in the newly generated DDS did not match what the RPG compiler was expecting based on the physical file's external description.
Attempt 2 succeeded. IBM Bob corrected the STUEML field length in the DDS, recompiled the PRTF, and recompiled the RPG program. Both compiled at severity 00 with no further errors. This completed the O-spec externalization step.

Step 4: Converting the Full Program to Free-Format RPGLE

With the printer file externalized and the RPG source updated, the working copy was ready for free-format conversion. At this stage, the program used an externally described printer file, and the O-specs had been removed.

The free-format conversion subtask loaded five IBM i Skills to guide the conversion:

These skills provided the language and conversion guidance for analyzing and converting the remaining specifications.

Complete Fixed-to-Free Conversion subtask showing 5 skills loaded in the right panel and the STUDRPT_T.RPGLE source open in the editor, with the updated WRITE opcodes already visible after O-spec externalization
Fixed-to-Free Conversion subtask — five skills loaded, working copy with WRITE opcodes ready for conversion.

Applying the Free-Format Changes

The conversion included the following changes:

Compiling the Converted Program

IBM Bob saved the converted source as STUDR_FREE.RPGLE in STUDLIB/QRPGLESRC.

It then compiled the program using CRTBNDRPG. Compilation succeeded on the first attempt with severity 00 and no errors.

This completed the conversion of the RPG program to free-format RPGLE.

The Final Result: STUDR_FREE.RPGLE

STUDR_FREE.RPGLE open in VS Code showing the complete free-format source with **FREE, CTL-OPT, DCL-F, DCL-S, DOW NOT %EOF, WRITE, and ENDDO, and the IBM Bob modernization summary panel on the right confirming compilation success, temp member deletion, and the comprehensive modernization summary report
STUDR_FREE.RPGLE — completed free-format output. Temp objects deleted, summary report generated.

What Made This Possible

The capabilities used in this modernization were provided through Premium Package for i (PPI). With IBM i Developer Mode active, IBM Bob could work directly with the IBM i system instead of simply generating code for manual implementation.

The RPG Modernization workflow coordinated the conversion, while IBM i Skills provided guidance for O-spec externalization and fixed-to-free conversion. IBM Bob also used tools such as generate_dds to create the external DDS printer file, CL commands to compile the printer file and RPG program, and SQL services to verify the compiled program object.

This allowed IBM Bob to analyze the source, make the required changes, compile the results, identify and correct a compilation issue, and produce the final free-format RPGLE source. The original program remained unchanged throughout the process.

Watch It in Action

A full walkthrough of the RPG Modernization workflow running live on IBM i, built using IBM i Developer Mode in IBM Bob Premium Package for i (PPI).

Next Steps

If you want to try IBM Bob and IBM Bob Premium Package for i (PPI) yourself, here are the resources to get started: