navigation graphic


PHP Resources RPG Resources Debugging Resources RDi Resources Windows 10 & IBM i CL Resources Our Videos Hot Tips!



RDi Shortcuts & Wizards

In this resource article, we wish to take you through how we can use shortcuts/wizards with RPG using Rational Developer for i.

It is all about productivity these days, gone are the days when we had a DPM (Data Processing Manager) looking over our shoulders to ensure we were thrashing out the code! (We did not have fancy job titles then either!).

Having been a programmer for over 35 years, anything that saves me coding, I am all for it. For example, if the database uses auto increments on account numbers, it saves me lines of coding, fantastic. So using Rational Developer, what do we have to help us with the programming?

The coding examples shown are all the latest free format type. Rational Developer is great for introducing us to this latest syntax.


The first wizard we are going to show you is how easy it is to code a sub-procedure.

The procedure wizard is very useful for remembering what piece of code to place where – where does the PI coding go, where does the PR coding go ….

To start the wizard, take Source → New → Procedure.


As we said at the beginning of this article, we are going to show you free-form code, ensure you tick the Generate free-form D-spec and P-spec code.

Enter all the details you need for the sub-procedure, including any parameters and return values. Once all details have been input, the code is generated and placed in the correct location within our source.

Our prototype and procedure is shown in the figure below.


The procedure wizard is a great way to standardise our coding.


With the D-Specification wizard, as you would imagine, we have lots of options for all the various layouts. As with the previous wizard select Source → New → D-Specification… this will start the wizard.

In the figure below, we can see all the options that are available.


For this example, we are going to generate a data structure to hold our supplier details. Select the D-Specification type of Program described data structure.


Once again, the source is generated and inserted where required in our source.

Java Method Call

Introduced in V5R1 of RPG, was the features to allow us to call Java objects. The wizards can help us enormously in creating the entire necessary source for us.

As with the previous two wizards select Source → New → Java Method Call … this will start the java wizard.

In the example below, we input the package and class details, then the java method to call.


All the procedures and definitions, along with the method call are coded for us.

Code Templates & Context Assist

As the name states, they are used to place template code in our C spec's. The advantage of using free-form coding is that the templates can be used throughout your code.

To see all the code templates already provided for us, navigate to Windows → Preferences then navigate as shown in the figure below.


If you need to create your own templates, use the New… button to create your own. So, how do we use these templates?

To include a template in your source, key the template name and press the ctrl-Space key combination. As can be seen below, I coded the SELECT keyword and pressed ctrl-Space then selected the SELECT_OTHER_group template and voila, the select group template has been included for me.


Context Assist

Personally, like many other programmers these days, I do not only code in RPG and the nuances between languages can cause confusion. For example, operational codes for string handling, like substring that is spelt different in other languages, very annoying!

This is where context assist functionality is a very useful. Context Assist uses the ctrl-Space key combination.

In the figure below, it can be seen if I type %SU then ctrl-space combination, all the valid operational codes are display, you can then drill down to the operational code you need. It will show all the necessary parameters, and their order.


One of the great features of context assist is that this functionality also works for any procedures that you have created.

In the figure below, we can see context assist popping up the details of our GetCustomerDetails procedure.


Code snippets

Code snippets are very similar to code templates and can be used to insert standard code into our source without having to open then copy and paste from other source members. Firstly, we have to open the snippets view.

This is achieved by selecting Windows → Show View → Other…


Then select General → Snippets


We will now see the Snippets View within our workbench.

Unfotunately, there are no RPG snippets predefined for us, but they are straightforward to create, so let us create some of our own. Right click anywhere in the Snippets view, then select Customize…


As we do not want our RPG snippets under the JSP category, let us create a new category called RPG where we can place all our RPG snippets.


Now we have an RPG heading, we can create a new item under it. This time select New → New Item. Enter the source for our snippet and any variables we require.


Our Snippets view now has a RPG section and newly created Heading snippet.


Double clicking on it will prompt us for the variables to insert as can be seen in the figure below.



We hope that this article will make your RPG coding more productive and help you use these excellent aids supplied by IBM.

If you need help with RPG and/or RDi, why not take a look at our training courses which can be found here...

  follow us on twitter   find us on facebook   follow us on linkedin   see our videos   find us on google+