MC Press Online

Thursday, Feb 23rd

Last updateWed, 22 Feb 2017 3pm

You are here: Home ARTICLES Programming RPG

Programming / RPG

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 Excel—and 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 ...

RPG Academy: Write Better Code - Commenting and Documenting Strategies

Usually, programmers don’t comment their code appropriately, for a variety of reasons: “I don’t have the time,” “My code speaks for itself,” etc. Mostly, they simply hate doing it. Let me try to refute these excuses with practical strategies and tools.

 rafael victoria preiraWritten by Rafael VictĂłria-Pereira

As I’ve said throughout this series, a procedure’s name and parameter list should be enough for the programmer to understand the objective of that piece of code. However, there are times when this is not enough: complex procedures, generic names, uninspired input/output parameter names…and the list goes on and on. The next section of this TechTip will help you in the process of creating proper documentation for your newly created procedures and functions, with a few tips of what you should and shouldn’t do.

Read more ...

IBM i Staff Changes: The End of the World as We Know It?

Another topic that seems to be topping the charts these days is the bemoaning of the retirement of RPG talent. But is it really one of the signs of the coming apocalypse?

david shireyWritten by Dave Shirey

A certain amount has been written lately about all the RPG talent that is getting ready to retire or die and what impact that will have on those of us who are still hanging on. Maybe it all started with a webinar (the recording's available) "Strategies for Overcoming IBM i Skills and Staffing Shortages"  given by Rob Rheault, Director of Application Services, and Marcel Sarrasin, VP of Corporate Marketing and Business Development, at Fresche Legacy. This webinar kicked off a certain amount of discussion in the RPG/AS400 Developers group on LinkedIn under a post by Kimberley Chan.

Read more ...

RPG Fundamentals Tip #3: Working with Nomain Modules

Unlike cycle main and linear main programs, nomain modules have no main procedure.

jim buckWritten by Bryan Meyers and Jim Buck

Editor’s note: This article is excerpted from Programming in ILE RPG, Fifth Edition, chapter 14, “Building Modular Programs with Procedures.”

The programs previously discussed [cycle main and linear main] are complete programs in themselves. They include a main procedure, along with all the other required subprocedures, coded within one source member, or compile unit. ILE also enhances modular programming concepts by allowing you to code a source member that consists of a segment of a program without a main procedure. The resulting Nomain module contains only subprocedures (one or more) that you can combine with other modules to create a program. By itself, a Nomain module cannot create a program object. One of the modules in a program must have a main procedure.

Read more ...

Practical RPG: Processing Stream Files, Part 1

We've all had to process a folder full of files from a PC or a UNIX machine; today we learn how to do it programmatically.

joe plutaWritten by Joe Pluta

If you're like me, you strongly believe that the IBM i is the best choice as your business integration hub. It talks just about any language, can handle any kind of data, and has unparalleled reliability. In fact, it's a prefect interpreter between other systems in your infrastructure. One of the things that IBM has focused on over the years is a fantastic capability to support stream files. Whether it's the UNIX-like capabilities of QShell, the stream file capabilities of commands like CPYFRMIMPF, or the ability to write C programs to directly access the files, there isn't a stream file requirement that can't be met by the IBM i.

Read more ...