Books by Bryan Meyers

Programming in RPG IV

Control Language Programming for IBM i

RPG IV Jump Start

Power Tips for RPG IV

VisualAge for RPG by Example

FAQs and Tips

Using %DEC to Convert Character to Numeric Print E-mail

Q. In your December 2004 article, "10 Cool Things About RPG IV," I could not get the %XLATE('$*,':' ':Amount) line to work. Testing the %XLATE with constant fields and stepping through it, I found the $ would be replaced by a space, but the asterisk and comma were left in. The only way it would work was to do three %Xlate functions - removing only one of the characters at a time. Did I do something wrong?

Read more ... Using %DEC to Convert Character to Numeric
RPG IV From A to Z Print E-mail

A comprehensive glossary of RPG IV and ILE terms

Read more ... RPG IV From A to Z
RPG IV Style for the 21st Century Print E-mail
Written by Bryan Meyers   

I've often postulated that few computer languages are changing as fast as RPG. Although it originated more than 40 years ago, RPG has evolved from a punch card heritage to a fully featured language that drives many modern business applications, in only a little more than a decade.

But has your programming style kept pace with RPG's evolution? It was only a few short years ago when I first wrote an RPG IV style guide and, despite my attempts to update it since then, my old, comfortable approaches to style, standards, and best practices get more outdated with every new release. In this article, I revisit and revise my suggestions for writing stylish RPG IV code.

Read more ... RPG IV Style for the 21st Century
Embedded SQL Using a Cursor Print E-mail

Q. I've decided to start using embedded SQL in my RPG programs, but I have a question. When I embed a SELECT statement which would normally return more than one record from a file, the RPG program only gets a single record. Is there a way to "wrap" the SELECT statement inside a loop, so that I can process all the records in the SELECT statement?

Read more ... Embedded SQL Using a Cursor
Replacing *ENTRY PLIST with a Prototype Print E-mail

Q. I am trying to find the /Free replacement for the *ENTRY PLIST. The conversion tool in WDSc doesn't touch this code. Is it possible to do this in /Free code?

Read more ... Replacing *ENTRY PLIST with a Prototype
Defining a Data Area Data Structure Print E-mail

Q. What is the best way using D-specs to define a data area, where I want to get the value from the data area and never lock the data area? We use a data area to hold an encryption key. Other programmers are using the old *DTAARA DEFINE, directly followed by an UNLOCK because they say the D-specs can't handle it without locking the data area. Is there a better way?

Read more ... Defining a Data Area Data Structure
Analyzing ILE Programs Print E-mail
Written by Bryan Meyers   

It's no secret that the Integrated Language Environment helps us all write more modular applications. Modules and service programs make it easy to construct programs from several small, easily maintained, reusable chunks of code. We can even create programs composed of several different languages.

Although development using modular chunks is easy, there is a bit of trouble in paradise. You sometimes need to know which application programs use particular modules and service programs. This is especially true when you modify modules and service programs, because you must rebind them to your application programs for the changes to take effect. In the past, there has been no convenient way to determine the modules and service programs your applications use. But now, you can have the Anzilepgm utility do the research and present the information to you.

Read more ... Analyzing ILE Programs
Free Format Alternatives to TIME Print E-mail

Q. In fixed format RPG IV, I used the TIME operation code to get the current date and time; but TIME is not supported by free format. You mentioned that the %DATE, %TIME, and %TIMESTAMP functions can replace TIME, but I'm not sure how to use them for this purpose.

Read more ... Free Format Alternatives to TIME