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

 
Frequently Asked Questions


Centering a Text String Print E-mail

The RPG IV language introduces several powerful built-in functions that simplify string-handling requirements. You can add a few more string-related procedures to come up with a complete toolbox for processing text. The Centertext procedure centers a string field, a function that's handy for centering headings on reports and displays.

Read more ... Centering a Text String
 
Binding Directory Organization Print E-mail

Q. I work in a shop where service programs and binding directories traditionally have a one-to-one relationship (that is, there is a binding directory for each service program). My preferred approach is service programs with functions related to a business area in a binding directory, then maybe two or three binding directories that cross business areas.

From this scheme it appears we would reduce the amount of time we spend managing our objects. Remembering that we try to keep the functions small, we should not create a lot of "code bloat"; should be able to avoid loading a lot of functionality that is not useful.

Read more ... Binding Directory Organization
 
Using /COPY for Prototypes Print E-mail

Q. You've recommended placing prototype (PR) definitions in copybook(s), then using /COPY to copy the prototypes into the modules that need them. At our company, some programmers place not only the prototypes in copybooks but also the procedure interface (PI) definitions too. Could there ever be a good reason to do this?

Read more ... Using /COPY for Prototypes
 
Prototype Problem with LIKE Print E-mail

Q. I'm trying to replace the *ENTRY PLIST with a prototype, so I can use CALLP and free format. But I'm running into a problem with the LIKE keyword. The compiler is giving me the following error: "LIKE not allowed with specified Field-Location entries; keyword is ignored."

Read more ... Prototype Problem with LIKE
 
Listing Source Change Dates for ILE Programs Print E-mail

Q. We have utilities that do a DSPOBJD to an output file. We then read this output file into a query specifically looking at the source file library, source file change date, and source file change time. This works on OPM programs but I cannot seem to get the same information on ILE programs. I've tried DSPOBJD and DSPPGM. Ideally I would want this information in an output file but if I have to do *PRINT and CPYSPLF I will. Do you know of any command that offers this for me? The most I've been able to come up with is program creation date; not source file change date.

Read more ... Listing Source Change Dates for ILE Programs
 
Processing Several Files with the Same File Specification Print E-mail

Q. I have an RPG program that needs to read a large number of files and perform the same processing for each of them. I may not know the file names at compile time. Some of the files have different record lengths, and some of them even have different formats, although the critical fields correspond in each file (e.g., each file format has a field called Tranamount, Signed(13.2). How can I accomplish this requirement without having to code separate file specifications for each file?

Read more ... Processing Several Files with the Same File Specification
 
Optimization and Debugging Problems Print E-mail

Q. I've been trying to debug an ILE program that's been running for some time. Recently, I recreated the program with full optimization to improve performance. But now the debugger doesn't work. What am I doing wrong?

Read more ... Optimization and Debugging Problems
 
Format a Date as a Text String Print E-mail

This procedure will return a variable length text string representing a date. For example:

String = Datetext(D'2010-01-01');     // Returns 'January 1, 2010'
String = Datetext();              // Returns formatted system date
String = Datetext(Mydate);     // Returns formatted date in Mydate
Reade more ... Format a Date as a Text String
 
<< Start < Prev 1 2 3 4 Next > End >>

Page 3 of 4