Building Out The .NET Stack Around Mono for IBM i
March 13, 2019 Alex Woodie
The first release of a Mono .NET port to IBM i was issued last year. Since then, the IBM i open source community has been busy building many of the other middleware components that will make it easier for developers to build IBM i applications using Microsoft tooling.
Mono was ported to AIX and IBM i (via the PASE AIX runtime) last year, which gave IBM i and AIX shops the capability to run the open source .NET runtime on Power Systems servers, thus opening the door to allowing Microsoft‘s highly regarded suite of development tools to be used to create applications for IBM i.
Calvin Buckley, who spearheaded the port, accomplished quite a bit just getting the C# compiler and the Common Language Runtime (CLR) – the core pieces that make up Mono — running on IBM i and AIX. But there was much more work to be done getting all of the ancillary components of a complete .NET stack up and running on IBM i, and Buckley clearly would not be able to do it all by himself.
One of the IBM i professionals who has taken up the .NET-for-IBM i torch is Richard Schoen, the director of document management technologies at HelpSystems. Schoen was a big believer in Microsoft’s .NET framework while developing software at RJS Software Systems, which HelpSystems bought in 2014, and he carried that fondness for .NET to his work at HelpSystems.
Schoen tells IT Jungle that, once he started working with the Mono port, he realized that it would need to be consumable on IBM i. “Calvin did a great job porting the .Net Mono code, but there are still some missing features,” Schoen says. “So I wanted to try and put together some practical examples that could be used on IBM i.”
His first stop on the Mono train took him to databases. After all, you can write the greatest piece of .NET code in history, but if the application can’t talk to a database, no useful work will be done. Developers typically need a database driver to connect their applications to database, so that’s where Schoen looked first.
“I started playing with the IBM Db2 Connect ODBC driver, which I was able to get to work unofficially on IBM i, but required a separate purchase and had some issues calling stored procedures,” Schoen explains. “Then I found Calvin’s Db2i-ADO .NET provider, which was a tweaked version of the IBM Db2 driver in Mono that works well currently for database actions, but the stored procedure calls and parm passing don’t seem to be working yet either.”
Running the database drivers in PASE is not a simple matter, according to Schoen, who says there are differences in how the IBM i and AIX variants work. There’s still work to be done before the Db2 driver will be up to speed in the PASE runtime.
“So in my quest for some production-ready database access, I tried my XMLSERVICE Wrapper API DLL, which works well with XMLSERVICE/XMLCGI for http based database access,” Schoen continues. “XMLSERVICE is good and production-ready, but does have some record buffer size limitations so developers have to be careful not to bring back large record sets when running queries.”
There are some other issues with XMLSERVICE, which is a library of open source RPG code that enables XML scripting calls of IBM i resources a variety of languages. For starters, the original architect of XMLSERVCIE, Tony Cairns, has retired from IBM, and IBM’s open source team is moving the project to GitHub.
That left Schoen with another dead-end. “I don’t know the current plans to release a better DB2 alternative driver for PASE,” he says. “I know Aaron Bartell was working on something as well, but he has moved on to other things non-IBM i as well.”
Schoen kept looking, however, and his search led him to a Liam Allan project called ILEusion. As a JSON-based replacement for XMLSERVICE, ILEusion provides a microservices layer that allows applications to request data via HTTP, and process data as JSON instead of XML. As Schoen notes, ILEusion was built atop “two very cool RPG MicroService app server frameworks from Niels Liisberg called ILEastic and noxDB.”
Schoen liked what he saw with Allan’s ILEusion project, and so he decided to develop a .NET layer that it could be consumed from .NET. “The performance is smoking fast and it works very well with .NET on any platform, including .Net Mono on IBM i,” Schoen says.
Alas, Schoen ran into more headwinds in December when Allan was forced to put the ILEusion project on hold. So Schoen stepped up and has decided to lead the ILEusion project himself, but under a different name, ILEaccess.
“Since [Allan] is no longer working on the project, I plan to continue his efforts on my own as a side project to bring this fast and reliable MicroService framework to the users of IBM i,” Schoen says. “Hopefully Liam will decide to return to the project in 2019 if he’s able.”
Schoen says the ILEAccess can serve as a replacement for XMLSERVICE on IBM i, no matter what language they’re using to develop IBM i applications. “Since all requests are JSON-based, the ILEaccess/ILEusion app server can be a full XMLSERVICE replacement for .NET, PHP, RPG, Node.Js, etc.,” he says. “And since the RPG code is available, developers can customize it to be their own.”
But Schoen isn’t done yet. In order to make the .Net Mono code fully accessible and useful from a regular IBM i job — and to be able to be called from CL, RPG or COBOL jobs – Schoen created a CL command called MONO, which is hosted in a library called MONOI (available on Schoen’s GitHub page, as is all of the code discussed here).
“The MONO CL command can call a .NET program in PASE and capture the STDOUT logging information that the .NET program outputs,” Schoen explains. “Think of this as being able to call a .NET application and capture joblog messages.”
The MONO command can return information from a .NET program call to an IFS log file; to an outfile or physical file in QTEMP so the log can be consumed by the current RPG or CL program; to a spool file if the log needs to be printed; and finally to the joblog in case the consumed .Net information needs to be accessible within the current jobs job log, Schoen explains.
“Think of the MONO CL command as the interface to .NET from the traditional IBM i programming model,” he says. “Now IBM i and .NET workloads can be fully and natively integrated on the platform.”
Schoen has also created a library of C# examples for using .NET from IBM i. There are just a handful of examples, but they will grow as time permits. While working on the examples, Schoen discovered that a .NET app could directly call PASE and QShell commands. So as another database option, he created a C# class called PaseCommandHelper that can interface directly with PASE commands to make DB2 database calls using the Db2 CLI (command line interface) and then pipe the data results back into the currently running .NET program.
There is clearly a lot involved with enabling a new development and runtime paradigm on the IBM i platform. Schoen and Buckley will be showcasing their work next Tuesday, March 19, in a QUSER meeting at the HelpSystems office in Eden Prairie, Minnesota.
Nice that you mention, that the ILEastic Project is from Niels Liisberg. It would be great if you also mention that he created also the Microservice Idea and everybody can use it in Production with encryption and scalability by using IceBreak which uses this technology for several years.
So this is a stable product and the only one which runs native in ILE.
We combine that Microservice Pattern with many RPG Programs which work together with Online Shops, mobile Apps and other Webservices.
Many thanks
Markus A. Litters
Great to see my work in ILEastic and noxDB being used in such a serous project.. Thank you!!