Why and how move to Free-Form RPG – PART 1

In this study the reasons to move to modern free-form language and the tools to do it. In the PART 2 we will see an example of conversion.

Available from the release V5R1 in the year 2001, on the RPG IV, the free from has been soon used extensively after positive feedback of developers.

The free-form syntax is a big improvement to the RPG language and has many productivity advantages. Developers can only enter their RPG logic from left to right naturally, similar to the coding style in other modern languages, without think about fixed columns.

To have a better understanding of why it is better to use free-form RPG style, there are at least five reasons to do it:

  1. Nested logic can be indent
  2. Source code can be entered faster
  3. More space to enter logical expressions
  4. Growing number of source examples in free-form
  5. Easier to learn for newcomers

Let us have a look at the single aspects:

 

  1. Nested logic can be indented

Understanding and maintaining nested logic could be difficult in fixed-format RPG, especially if there are different nested levels of deep and this could be time consuming. For example the following code:

 

This logic it is hard to follow….

In the free-form RPG this code become the follow:

More easy to manage

 

2    Source code can be entered faster

The free-form style allow you to enter source in a more compact and natural way.

For example you don’ need to use EVAL or CALLP when assigning values or calling procedures:

 

3  More space to enter logical expressions

In fixed-format RPG, there are only 45 characters available in the extended factor 2 area. If your expression extends beyond 45 characters in a C specification, then you have to create a new line. However using the free-form style, you can enter up to 73 characters of an expression per line.

 

4 Growing number of source examples in free-form

Since free- form has been available, most of the RPG authors are now writing their books and articles in this style, so you could have the availability of a lot of free-code examples.

 

5 Easier to learn for newcomers

The free-form style is similar to the style of modern languages, so it is more easy to teach for new students who want to develop in RPG language.

 

Now that we have understood the need to move to free-form RPG, we could think to examine how to move from old code style to new code style and which kind of work we have to manage. Tools are available to quickly transform the code but not all the code will be ready immediately; sometime by hand adjustment will be necessary.

In this post I will show three solution for a first conversion.

I will detail in a new post the manual adjustment that you could do after an automatic conversion.

So to convert RPG code there are at least three way:

A) The IBM solution

B) The “RPG Conversion Wizard” (by HelpSystems)

C) The “ARCAD Trasformer RPG” (by ARCAD)

 

A) The IBM solution by (Remote Systems LPEX editor):

First thing you should convert your RPGII code into RPGIII code, by using the CVTRPGSRC command. After you should use Rational Developer for I to launch the “Convert Selection to Free-Form” option. Unfortunately this Option converts only your C-specs into free-form syntax…. So H-, D-, F- specs are out.

In the screens (from RDI), you should open your source with LPEX editor and after launch the convertion on the source code selected (by using right click of the mouse).

 

Here the IBM link about the RPG conversion:

https://www.ibm.com/support/knowledgecenter/SSAE4W_9.1.1/com.ibm.etools.iseries.rse.doc/topics/teditfree.html

 

B) RPG Conversion Wizard (by HelpSystems)

HelpSystems lets to have a free trial of this tool.

You have the possibility to execute these four types of conversions through RPG Toolbox:

  • Convert RPG III and RPG/400 source code to modernized RPG IV syntax
  • Update existing RPG IV source code to take advantage of modern syntax
  • Convert RPG IV fixed-format Calculation specifications to free form syntax
  • Convert H, F, D, and P specifications to free form syntax

The conversions can be performed from SEU or IBM’s RDi development environment. RPG Toolbox’s flexibility allows you to convert entire source members or blocks of source code within a member.

 

Here the link about the HelpSystems tool:

https://www.helpsystems.com/products/rpgtoolbox-ibmi/features

 

C) The “ARCAD Trasformer RPG”

ARCAD too lets to use for a trial his tool. With this tool you could:

  • Automates the conversion of any RPG IV source code into RPG Free Format
  • Near 100% conversion accuracy
  • Full conversion of C, H, F, D, P specifications
  • Converts GOTO statements
  • Supports both mass and unitary conversion
  • Obtain an optimal number of conversions, based on the size of your application suite

 

For best results (complete conversion of C, H, F, D, P specs), a minimum of IBM i V7R1 with TR7 is required.  If you don’t yet have TR7, only C specifications with be converted.

 

Here the link of ARCAD tool:

ARCAD-Transformer RPG (aka ARCAD RPG Converter for IBM i)

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *