Long time no see! :) . It has been a while since my last post. Here is a little different post. I compiled a list of things I really like a lot about RPG and the ILE environment and am missing (most of the time) in other programming languages / environments.

Note: The features in the list are in no special order.

  1. Database connections — This one is a real no brainer. I have encountered no other programming language or environment where it is so easy to get access to the database as on IBM i and with RPG. No connection pooling, no connection management. Just “always on” :) !

  2. Database operations — This is also about the database but more about how to work with / access the database from RPG and not about the connection. In RPG we can choose between the built-in support for Record-Level-Access and embedded SQL. No extra library to load. Just working out of the box.

  3. Data types — RPG has a rich collection of data types. Integers and chars are not coverd by every programming language but you probably won’t find a numeric data type with fixed decimal positions. Date, time and timestamp are also very nice to have and especially the operations you can do with them in RPG.

  4. Pointers — Not widely used in RPG but pointer support is really nice. Especially the feature that you can declare a variable based on a pointer.

  5. User heaps — User defined memory heaps are really cool when you have to deal a lot with dynamic memory management. You don’t necessarily have to keep track of all the allocated memory. Just discard the heap and everything is cleaned up for you by the system. No keeping track of pointers. Another cool feature is that you can mark a memory allocation in the heap and later free up everything up to that mark.

  6. User spaces — User spaces also exist on other platforms but I think they don’t have so many features there. On IBM i user spaces are real objects on the file system with all features of an object in the QSYS.LIB file system. They are also persistent between reboots.

  7. Data areas — These easy to use objects are great for storing simple data. They have native support for editing and displaying the data and are fully integrated into the RPG programming language. On other platforms you would probably use a normal text file. But reading, locking and writing a text file on other platforms is not as easy as in RPG.

  8. CCSID conversion — Another great underrated feature is the CCSID support in RPG. You can declare a character variable with any CCSID and assign a value to it. This value will be automatically converted to the CCSID of the declared variable. No extra step needed. So for converting a value with EBCDIC CCSID 37 to UTF-8 is only declaration of two variables and the assignment of the value. That’s it.

  9. Compile time data — This is usually used to initialize arrays. It can easily be achieved by other means in other programming languages but I found a liking to how it is done in RPG.

  10. Polyglot — One of the biggest things in the ILE environment IMO is the possiblitly to bind multiple modules coded in different programming languages together to a single program object. Coupled with the fact that one can use any exported symbol (function, procedure, data) from any ILE capable language makes way for many possiblities and let you choose the right language for the task. F. e. C for networking stuff and RPG for business logic and data processing. ILEastic is my favorite example for demonstrating this.

  11. Thread safety — Most of the time the normal RPG developer won’t have to bother about threads and thread safety. But if your application or framework makes use of multiple threads you need to make sure that your code is thread safe. This is super easy in RPG. Just add a control option to your code like this:

    ctl-opt thread(*concurrent);

    Note: If you are using embedded SQL and transactions this control option will not be enough because transactions are scoped to the job or activation group. One solution to this is to activate the SQL Server Mode with the QWTCHGJB API.

  12. Data queues — This is more a platform feature than a programming language feature. But I add it anyway as it is a great tool for developers. Queues are also natively available on other platforms but rather as in memory data structures (not RPG data structures) to operate in one process and not to communicate between different processes as is often the case on IBM i. So if you have a need to decouple programs but don’t want to install a full blown message queueing system you can often easily achieve things with a data queue (when it comes to one-to-one communications, no pub/sub support). Data queues can also be peristent and really fast.

So these are 12 features of RPG and ILE I really like. There are definitely more great features.

What are your top things you like about RPG and the ILE environment?

Happy coding!