You are currently on IBM Systems Media’s archival website. Click here to view our new website.


Using the RPG Graphical Chart Engine to Create Graphs

Once you've executed RCE_newPieChart to set header-level data and executed RCE_addPieChartData to enter all detail-level data, you're ready to execute the RCE_run sub procedure. Here's where a whole bunch of work is done for you behind the scenes. Basically the RCE_run sub procedure sends a message to keyed data queue DQRCE. Listening for input entries on DQRCE is the Java side of RPG Chart Engine. When Java receives an entry, it uses the DB2 records' unique IDs to obtain access to all of the necessary information used to build the graphical chart. After it has created the JPG file it will write a data queue entry back into DQRCE that the RPG Chart Engine service program is listening/waiting for. Once received control returns to your calling program. The best part is you don't need to care about those details. Instead you just need to install RPG Chart Engine and run a prompt-able command to start the Java that waits for messages on the data queue! Note the below STRRCE only needs to be started once and will service all users/jobs on your System i platform. In this way each user doesn't incur the JVM startup costs of invoking Java.

Figure 2 shows a screen shot of the necessary information to specify on the Start RPG Chart Engine (STRRCE) command. Or here is the result of the Figure 2:


Command STRRCE calls CL program STRRCEC, which submits a RUNJVA job to QBATCH. This initializes the Java process and starts it waiting on data queue DQRCE. For reference purposes of how this is done please see Figure 3.

Now that you know how the tool works, the next step would be to install it on your System i platform. This is a two-part process as both RPG and Java are included in the zip download. Detailed instructions are included in the download readme.txt but in general, you upload a *SAVF to QGPL/RCE.SAVF and then upload the Java jar files to /java/rce in the IFS. Go to and click on the RPG Report Engine link to download.

The RPG Report Engine is in its first version and thus only supports three charts - RCE_newPieChart, RCE_newBarChart and RCE_newXYLineChart. New charts can be added fairly easily by adding a new sub procedure to the RCEFN program and modifying the source file (included in download). I built the underlying DB2 tables--RCEHDRPF and RCEDTAPF--to facilitate holding data for any of the other charts supported (in theory). The array of other charts can be seen at, select the "JFreeChartDemo (web start)" link to get the full picture of different charts. Feel free to contact me if you have a particular chart need and would like help creating it.

That's it for now. Stay tuned for more open-source tooling coming from in the coming months!

Aaron Bartell is Director of IBM i Innovation for Krengel Technology Inc. and an IBM Champion.



2019 Solutions Edition

A Comprehensive Online Buyer's Guide to Solutions, Services and Education.

New and Improved XML-INTO

Namespace support makes the opcode a viable option

Authenticating on the Web

The finer points of OpenRPGUI, Part 1

The Microphone is Open

Add your voice: Should IBM i include open-source RPG tools?

IBM Systems Magazine Subscribe Box Read Now Link Subscribe Now Link iPad App Google Play Store
IBMi News Sign Up Today! Past News Letters