noxDB - Not Only XML - is a software library which makes it easy to parse and generate JSON and XML. Generating JSON or XML directly from an SQL is even easier with noxDB. noxDB has become my favorite tool when working with JSON or XML when I want to process it with a DOM like approach … which is most of the time.

Even Easier

But to top it all off we can make it even easier. Till now it was a bit of a pain to install noxDB (depending on your environment, f. e. installed tools). This has been alleviated as we now have a nice RPM package which can be used with iPKG. To install noxDB with iPKG we just need the iPKG client on our machine (available here) and execute the install command.

ipkg install noxdb2

This will install the noxDB service program (NOXDB2) in the library IPKG and also adds it to the binding directory IPKG in the installation library. The installation library can be specified on the install command with the parameter IPKGLIB.

If you want to use the service program you will need the RPG prototypes. These are also packaged and can be installed in the same manner.

ipkg install 'noxdb2-devel'

The prototypes are saved in a stream file. By default this stream file will be placed in the IFS in the folder /usr/local/include. But this can also be changed on the install command with the parameter LOC (location).

iPKG is not a global package manager. It works more like NPM where packages are managed on a per project base (per library in our case). To make a package installation only for a single user you just need to specify a separate library on the install command. To have noxDB installed in my own library and home directory I would call the following commands:

ipkg install noxdb2 ipkglib(MIHAEL)
ipkg install 'noxdb2-devel' ipkglib(MIHAEL) loc('/home/mihael/include')

If you want to know more about iPKG take a look at the project wiki and this and this blog post.

Note: The noxdb2 package provides the utf8 branch of the noxDB project which is not yet on par with the main branch when it comes to functionality but covers all the basics already.

Now that we have installed noxDB how to use it in RPG?


Starting situation:

  • noxDB installed in library MIHAEL (service program NOXDB2)
  • NOXDB2 registered in the binding directory MIHAEL/IPKG
  • library MIHAEL is part of the library list
  • noxDB2 prototypes installed in folder /home/mihael/include (package noxdb2-devel)
  • prototypes available at /home/mihael/include/noxdb2/noxDB2.rpgle

We are now set for creating our first RPG program with the new noxDB installation. It will be a FREE RPG program (though we can also use it in a non FREE RPG program but it has to be an ILE program). So our program starts with


For this little example we compile it in one go with the command CRTBNDRPG so we can add some compile options in the code (for production I would go with the two step approach of first creating a module with CRTRPGMOD and then creating the program with CRTPGM).

ctl-opt dftactgrp(*no) actgrp(*caller) bnddir('IPKG');

Next we need to include the noxDB prototypes.

/include '/home/mihael/include/noxdb2/noxDB2.rpgle'

I like to directly jump into a procedure at program start without forfeiting the default error handler.

*inlr = *on;

And here is our main procedure where we parse a JSON string, modify the noxDB object graph and output it with the DSPLY opcode.

dcl-proc main;
dcl-s json pointer;
dcl-s s char(50);

json = nox_parseString('{ "game" : "Elden Ring" , "releaseDate" : "Q1/2022" }');
nox_setStr(json : 'releaseDate' : '2022-02-24');
nox_setStr(json : 'price' : '59,99 €');
s = nox_asJsonText(json);
dsply s;


What’s next?

As noxDB is now available via iPKG providing ILEastic as a RPM package for usage with iPKG is on my list.

Also thanks and kudos to Niels Liisberg for creating these wonderful projects noxDB and ILEastic.

Happy installing!