Rational Developer - Access Service Program Procedures Using Templates
If you use IBM Rational Developer Tools, you'll know that it's leaps and bounds ahead of SEU for coding RPGLE, but when you compare it to the experience of developing with other languages in the Eclipse IDE you'll have to agree that it's not quite as slick. One thing I love about the Java development environment is having access to class methods using code completion, but with RPG not being an OO language it obviously makes this kind of feature technically challenging!
Since we started taking advantage of ILE service programs over a decade ago, we've amassed a huge library of functions & procedures that we use day in, day out, but referencing these often involves heading over to a 5250 session to use one of our in-house development tools to search for the exact procedure name.
It was during one of these searches that I yearned for an easy way to easily access the list of available procedures from within Rational itself. After a bit of Googling, and some rummaging around in the file system I came up with a simple and elegant solution.
Templates
Rational Developer allows code completion (Via shortcut Ctrl+Space) that includes any templates that are defined in your workspace. It comes bundled with some basic loop structures by default, but you can add your own templates in the application preferences.
These templates are actually stored in a file (templates.xml) which resides in the \.metadata\.plugins\com.ibm.etools.iseries.edit subdirectory of your workspace.
With this in mind I wrote a process to generate my own version of templates.xml, populating it with all the procedures that are exported by the library of service programs:
HSSF_ADDPICTURE(${CURSOR}) HSSF_BEGIN_OBJECT_GROUP(${CURSOR}) HSSF_CELLNAME(${CURSOR}) ...
I then replaced the copy of this file in my workspace, restarted Rational, and sure enough there were all the new templates:
These were then available after typing the first few characters, and pressing Ctrl+Space:
Selecting the desired procedure added it to the source:
Automation
Not wanting to rely on data that could get stale pretty quickly, I sought to automate the process by scheduling a daily job to generate templates.xml in the IFS of our dev machine (Making it available to all developers in the process) and then created a batch file to robocopy the file into my workspace.
robocopy \\serverName\rational %UserProfile%\Documents\Workspace\.metadata\.plugins\com.ibm.etools.iseries.edit templates.xml
I then configured the batch file to run at a set time each day using Windows Task Scheduler.
Work In Progress
This is just a first cut to ensure that the basic data is available within Rational, and verify that the mechanism works end to end, but there's certainly more that I would like to do to improve it.
For example, it would be incredibly useful to be able view the parameters required by each procedure:
createsISODate(p_day 2s0 const: p_month 2s0 const: p_year 2s0 const)
Unfortunately we don't currently have that information readily available in our developer tools database, but I'm sure it won't take long to extract it, especially as I now have all our procedures at my fingertips...
** Update 13/11/2012 ** It's been pointed out at that Rational Code Assist will already include prototypes in /include and /copy members, but only if you refresh the Outline view. This is certainly a great option for anyone who doesn't already have easy access to their exported procedures.
The problem I have with that is that we currently have over 100 source members, so it would require including the appropriate one before the code assist will pick up the relevant prototypes. I'm going to investigate the effect of having a single /include to pick up all the prototypes in one go and see if this gives a better experience.