In this study I will give more details about tools showed in PART1 (https://linkedibmi.com/2017/10/28/move-free-form-rpg-part-1/).
I hope it could be useful to understand how these tools work, even if only by try them, you will discover all the details for a better use. One step more for modernization.
First I would analize “RPG Conversion Wizard (by HelpSystems)”.
HelpSystems offers a free license for 30 days or 10 conversions: please see guide for more details. In this example I will use the tool from command line, but you could do the same from RDI environment as detailed in “RPG Toolbox RDi Plugin” section of the guide.
So the first think you should do, it is to connect at the link:
And create a free account:
Then you could access to the download area and you could select the tool and the guide “RPGToolBox_Manual.pdf”:
The guide give you information about the installation steps:
The RSTLICPGM will create on your server the license for “4RPGBOX” product:
You should use directly the command:
RPGTOOLBOX/RPGWIZ FROMFILE(LibraryName/QRPGSRC) FROMMBR(MemberName) TOFILE(QRPGSRC) TOMBR(NewMemberName) FMTCALC(*FREE)
Or set the Menu of Commands, where there are others helpful utilities that could be used.
The command for RPG convertion has these options (The source must be RPGLE so you should launch CVTRPGSRC on your old RPG code before to use this tool):
To give you all the details I get this FROM THE HELP OF THE COMMAND:
All eligible fixed-format calculation operations will be converted to their free-form equivalents. This option is only valid for IBM i release V5R1 and higher.
If an error result indicator is specified on an ACQ, CLOSE, COMMIT, DEALLOC, DSPLY, FEOD, IN, NEXT, OPEN, OUT, POST, REL, RESET, ROLBK, TEST or UNLOCK operation, this operation will be qualified with an (E) extender and the error indicator will be converted into an inserted %ERROR BIF.
Comment line asterisks(*) will be converted to slashes(//) within the new free-form logic.
Any existing right-hand comments will be proceeded with slashes(//) notation starting in position 81.
The appropriate /FREE and /END-FREE tags will be inserted around the new free-form logic.
Operations without free-form equivalents will remain in fixed format. As of IBM i release V5R1, these unsupported opcodes include
ADD, ADDDUR, ALLOC, ANDxx, BITxx, CABxx, CALL, CALLB, CASxx, CAT, CHECK, CHECKR, COMP, DEFINE, DIV, DO, DOUxx, DOWxx, END, EXTRCT, GOTO, IFxx, KFLD, KLIST, LOOKUP, MzzZO, MOVE, MOVEA, MOVEL, MULT, MVR, OCCUR, ORxx, PARM, PLIST, REALLOC, SCAN, SETON, SETOFF, SHTDN, SQRT, SUB, SUBDUR, SUBST, TAG, TESTB, TESTN, TESTZ, TIME, WHENxx, XFOOT, XLATE, Z-ADD and Z-SUB. Using RPGWIZ with the correct parameter settings, most of these operations can be converted to operations which are supported in free-form.
To maximize your conversion to free-form, you should also review activating these additional parameters:
o Redefine *LIKE DEFN fields (LIKEFLD)
o Redefine calc. defined fields (CALCFLD)
o Convert left hand indicators (CVTLEFT)
o Convert opcodes to BIFs (OPCODEBIF)
o Insert file I/O BIFs (FILEBIF)
o Convert ADDs/SUBs to EVALs (CVTADDSUB)
o Convert Z-ADDs/Z-SUBs to EVALs (CVTZADDSUB)
o Convert MULTs to EVALs (CVTMULT)
o Convert DIVs to EVALs (CVTDIV)
o Convert MOVE(L)s having *BLANK (CVTMOVEBL)
o Convert MOVE(L)s having *ZERO (CVTMOVEZR)
o Convert MOVEs having data (CVTMOVER)
o Convert MOVELs having data (CVTMOVEL)
o Convert MOVEA operations (CVTMOVEA)
o Convert CASxx operations (CVTCAS)
o Convert CAT operations (CVTCAT)
o Convert DOs to FORs (CVTDO)
o Convert LOOKUP operations (CVTLOOKUP)
o Convert SCAN operations (CVTSCAN)
o Convert *ENTRY PLIST (CVTENTRY)
o Convert CALLs and CALLBs (CVTCALL)
o Convert GOTO operations (CVTGOTO)
Operations with unconverted left-hand indicators, result indicators or result field lengths will not be converted to free-form.
Like the *FREE option, the *FREE2 will convert C specifications into their free-form equivalents. In addition, the *FREE2 option will also convert H, F, D and P specifications into free-form syntax.
The *FREE2 option will additionally remove any /free and /end-free directives from the source.
The *FREE2 option is only valid when targeting IBM i release V7R1 and higher. This level of free-form syntax was made available with the IBM i Technology Refresh 7 in November 2013.
To support this free-form level in V7R1, you will need IBM PTF SI51094. For SQLRPGLE member types, you will also need IBM DB2 group PTF SF99701 level 26.
Like the *FREE2 option, the *FREE3 will convert C specifications into their free-form equivalents and also convert H, F, D and P specifications into free-form syntax. In addition, the *FREE3 option
will add a new line to the top of the source starting in position 1.
The line will contain the text **FREE.
The *FREE3 option will additionally move all free form code from position 8 to position 1. It will preserve indenting. The *FREE3 option will not move any left over fixed form code.
The *FREE3 option is only valid when targeting IBM i release V7R1 and higher. This level of free-form syntax was made available with the IBM i Technology Refresh 11 on V7R1 and Technology Refresh 3 on V7R2 in October 2015.
I tried a first launch on a source and here there is a piece of transformed code:
against the old version:
Note that when fields aren’t “resolved” for missing libraries the tool leaves the original code. See the ($$DT01 line):