MC Press Online

Sunday, Apr 30th

Last updateFri, 28 Apr 2017 10am

You are here: Home ARTICLES Programming RPG

Programming / RPG

RPG Academy: Debug Done Right - Choosing the Right Debug View

Rafael Victoria-Pereira

Let’s finish the debug views discussion started in the previous TechTip and learn how to choose the right debug view for you.

Written by Rafael Victória-Pereira

In the previous TechTip, I discussed the *STMT*SOURCE, and *COPY debug view keywords. Let’s continue that discussion now. The next keyword on our list, in terms of the debug information provided (and the object size), is *LIST, shown in Figure 1.

Read more ...

Practical RPG: Techniques for Procedures

Joe Pluta

The procedure is one of the most powerful additions to RPG, and this article shows you some ways to leverage that power.

Written by Joe Pluta

Procedures are the Swiss army knife of application architecture on the IBM midrange platform. They provide everything from simple organization of single programs to large-scale inter-language communication across entire business applications. In order to provide all these functions, procedures necessarily have a lot of options that apply to a lot of different situations. Today, we're going to try to standardize a few of those options.

Read more ...

RPG Academy: Debug Done Right - Introducing the ILE Debugger

Rafael Victoria-Pereira

Have you met the “new” ILE Debugger? Forget ISDB. The future of debug is here.

Written by Rafael Victória-Pereira

It’s really hard to write a complete and complex piece of code without a bug or two, so you’re probably no stranger to the Interactive Source Debugger (ISDB) that has served RPG programmers since V3R1. Now that you’re moving into the brave new world of ILE, it’s also time to upgrade your debugging skills. In this subseries, you’ll learn what you need to know to turn your time-consuming pains with ISDB into something more pleasant and efficient with ILE debugger.

Read more ...

Practical RPG: Converting to Free-Form RPG, Part 1

Joe Pluta

Free-format RPG is the future, but getting there is still an adventure.

Written by Joe Pluta

Even the best conversion tools only get you part of the way to free-format RPG; here is the first step of the rest of the journey.

I no longer write programs with fixed-format specifications. In fact, when I do occasionally have to work on an older machine, I confess that I find myself stumbling around a bit with F-specs for files. The other day I had to remind myself how to define a data area. It took a while to get to the point where I was comfortable writing all my code in free-form RPG, especially when it came to display files. But the longest journey starts with a single step, and this article is intended to start you on that path.

Read more ...

Practical RPG: Refactoring in RDi

Joe Pluta

Rational snuck a feature in under the radar that might signal a sea change for the product.

Written by Joe Pluta

What is refactoring, and why do you care?

Refactoring in the broadest sense refers to an intelligent, comprehensive change to your program source. The least complicated example is a simple rename, while a more complex case might involve pulling out all occurrences of a common piece of code and putting that into a callable routine.

Read more ...

RPG Academy: Write Better Code - More on Commenting and Documenting Strategies

Rafael Victória-Pereira

This TechTip will continue to discuss the documentation topic, focusing on the tools that an RPG programmer has available and offering a few tips to help define a proper documentation strategy (even if you think you don’t need one).

Written by Rafael Victória-Pereira

One of my favorite things about “modern” languages is the self-documenting features that most of them have. For instance, Java has Javadoc, a documentation generator from Oracle Corporation that is designed to automatically produce documentation in HTML format from Java source code. The HTML format is used to add the convenience of being able to hyperlink related documents together. The “doc comments” format used by Javadoc is the de facto industry standard for documenting Java classes. Some Integrated Development Environments (IDEs), such as NetBeans and Eclipse, automatically generate Javadoc HTML code. There are a lot of file editors to assist the developer in producing Javadoc source and using the Javadoc information as internal references for the programmer. This made me wonder if we, RPG programmers, had been forgotten by IBM in this regard.

Read more ...

Practical SQL: Field Reference Files in DDL

Joe Pluta

SQL does field reference files, too!

Written by Joe Pluta

In a previous article, I discussed how naming conventions really help in database design and programming, and in so doing I touched upon the concept of the field reference file. Field reference files are an easy way to make sure your data elements are consistent, but I'll bet you didn't know you could use them in DDL as well. In this article, I'll show you how it's done.

Read more ...

Practical RPG: Processing Stream Files, Part 2

In part 1, we processed a directory. In part 2, we process one file in that directory.

joe plutaWritten by Joe Pluta

Stream files are not database files.

While that statement is obvious to programmers, it's not always clear to the greater community. The end users, the folks whose jobs we are supposed to be supporting, use various forms of stream files to store their data, and they don't understand why we can't for example just "use this spreadsheet" as part of our application. And while that's an interesting philosophical discussion, as programmers we sometimes have to simply get things done, and that in turn means taking whatever data the user sent us. I've spent a lot of time over the years importing data primarily from Exceland more specifically from comma-delimited files. Two techniques exist: CPYFRMIMPF and parsing the data in RPG. CPYFRMIMPF is a completely different animal that perhaps can be covered another day. Today, I just want to talk about parsing a stream file.

Read more ...