MC Press Online

Monday, Jan 16th

Last updateMon, 16 Jan 2017 11am

You are here: Home ARTICLES Programming RPG

Programming / RPG

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 ...

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 ...

RPG Academy: Write Better Code - More Tips for Organizing Your Modules and Service Programs

The previous article of the series discussed module and service program organization. It’s now time to do the same for binding directories.

rafael victoria preiraWritten by Rafael Victória-Pereira

Let’s start with a quick recap of binding directories. Your modules will be composed of procedures. Some of these procedures are going to be available to the outside world; these are the module’s exports. The module’s procedures might call procedures from other service programs; these are the module’s imports. The problem is that the compiler has no idea where to find those procedures that your module’s code is calling, if they don’t belong to the same module/service program.

Read more ...