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



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
 
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
 
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
 
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
 
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
 
Dynamic Memory Allocation and Arrays Print E-mail

Q. How do I declare an array with a dynamic number of elements?

Read more ... Dynamic Memory Allocation and Arrays
 
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
 
Free Format Alternatives to MOVE Print E-mail

Q. I've been trying to convert a series of RPG IV programs to free format, but I've been very frustrated, because free format doesn't support the MOVE operation. I don't want to switch back and forth between fixed format and free format (the result is ugly). What can I do? Is there an easy alternative?

Read more ... Free Format Alternatives to MOVE
 
Debugging a Batch Job Print E-mail

Q. Your RPG for RPG Programmers presentation covered the ILE debugger for interactive jobs. But I need to debug a batch program. Do I need a different debugger?

Read more ... Debugging a Batch Job
 
Record Locking Problem in a Monitor Block Print E-mail

Q. I am trying to find out which user is causing a record lock. I should be able to get some basic information on the record lock by examining the exception data subfield in the Program Status Data Structure (PSDS). But instead of the promised "Record in use by job ..." data which actually names the job holding the lock, I get a more generic "Unable to allocate a record..." message.

What's up with that?

Read more ... Record Locking Problem in a Monitor Block