Working with Free: More Than Just Coffee
The RPG Roast – Real Code, Real Coffee, No Nonsense
As I write this post, I’m thinking about what “free” really means. Today,
it means a free cup of coffee—specifically, a cup of Eggo Waffle Vanilla blend
that my wife won in a giveaway. It’s
a light roast with a vanilla waffle kick and just a splash of childhood
memories. Not bad.
But in the RPG world, “free” has a different flavor.
I’m not talking about the old /free and /end-free days. I’m talking about fully free-form RPG, introduced with the **free directive. This isn’t just a syntax change—it’s a sign
that RPG is growing up and stepping into the modern world.
Here’s the Issue I Ran Into Recently
One of the IBM i tool guys came to me about an issue a tool was having
with a totally free-format RPG source. He thought maybe the tool couldn’t
handle fully free-form RPG. I took a look.
I usually work in IBM Rational Developer for i (RDi), but I’ve
been experimenting with VS Code lately. While reviewing a source member
with some parsing issues, I noticed RDi was choking on the file. For grins, I
checked the same code in VS Code—it worked just fine.
After some digging, I realized the problem wasn’t the **free itself—it was where it was.
Some developers had it on line 2 or later.
Turns out:
**free must be the very first thing in the
source—line 1, column 1.
Anything else, and the parser throws a fit.
Why This Is a Real Risk
This isn’t just a cosmetic issue—it can break your builds.
Programs compiled in RDi will fail if **free isn’t at the top. However, some third-party tools—especially change
management systems—and even VS Code may compile the same program without
issue. That inconsistency creates real risk.
Just because it compiles somewhere doesn’t mean it’s correct or portable.
I brought this up with a group of developers.
Some said they never include **free and it still compiles. Others didn’t know it had to be on line 1.
❌ Wrong vs ✅ Right: Quick Example
// ❌ Incorrect - Will fail in RDi
// Some comment
**free
dcl-s MyVar char(10);
…
*inlr=*on;
**free
// ✅ Correct - Works everywhere
// Some comment
dcl-s MyVar char(10);
…
*inlr=*on;
If **free isn’t on line 1, the compiler assumes the source is fixed-format or old-school RPG.
Other Pushback I’ve Heard
Some developers complain that fully free-form RPG removes the ability to
use columns 1–5 for in-line comments. That’s true—but it’s a weak argument.
Modern RPG gives you:
- Standard // inline comments
- More meaningful annotations with
tags or labels (like // TODO: or // LOGIC:)
Let’s not cling to 1995 habits. There are better, cleaner ways to mark up
your code.
Why This Matters
Some developers don’t know this. Others don’t care. But here’s the deal:
You should:
- ✅ Use **free if you’re writing new RPG code
- ✅ Put it right at the top of your source member
- ✅ Take full advantage of what modern RPG gives you
- ✅ Don’t just
copy old programs or fixed-format code for a new project—convert it to
totally free-form. It’s worth the effort.
What You Get with Fully Free-Form RPG
- No column restrictions
- Cleaner, more readable code
- No line length limitations (aside
from physical file constraints)
- Easier onboarding for new
developers
- Better tooling and modern editor
support
- A step forward for the IBM i
platform
đź› Tooling Tip
RDi, VS Code (via Code for IBM i), and back-end compilers do not always
behave the same way.
Standardize and enforce how your developers
code. Validate
the processes used by your tools—change management systems, editors, compilers,
and CI/CD pipelines. If they don't follow the same rules, have a conversation
or open a bug report. These issues can be fixed and addressed. Don’t let tool
differences create hidden bugs or inconsistent behavior.
For New Developers and Tech Leads
If you’re mentoring junior devs or modernizing legacy systems,
enforcing proper use of **free is an easy,
high-impact step.
It communicates your team's commitment to clean, modern RPG—and signals that
your shop isn’t stuck in the past.
Final Sip
So whether your “free” today is a cup of Eggo coffee or a clean RPG
source file, take a moment to appreciate it. Small things. Big impact.
What’s your experience been with **free and free-form RPG?
Drop your favorite compiler quirk—or horror story—in the comments.
See you next Friday.
—George
Comments
Post a Comment