[Parameters]
Purpose
Converts an RPG or RPG/ILE source member from fixed-format RPG to free-form RPG.
Features
- Non-destructive conversion
- The utility converts the source from one member to a new member (the original source is left untouched), converting, where possible, fixed-format code to free-form code.
- Clearer, cleaner code
Free-form code (both new and existing) is indented to show nesting, and all opcodes are converted to a standard case format for consistency.
- Definition consolidation
All in-line field definitions are moved to 'D' specs. Duplicate definitions (which do not generate compiler errors when defined in fixed-format) are dropped to avoid confusion.
- Consistent free-form definitions.
File, constant and variable declarations are converted to their free-form equivalents (see caveats below).
- CMS-friendly
Converted lines have their original change date (and prefix) preserved in order to avoid flagging changes in CMSes that use such features to track changes.
- Audit Report
An audit report is produced listing every source member processed by the utility, detailing the number of lines, the number of lines converted and a conversion ratio.
- Mass conversion
The utility can be run for all members of a source file, enabling the mass conversion of legacy code to the latest free-form version.
Caveats
The resulting converted source is not necessarily 100% compilable, and may require some additional manual alterations in order to compile cleanly. Please refer to the 'caveats' below for further things to be aware of.
The following are not (currently) converted
- Program-described files
- MOVE - these are converted where deemed safe to do so, but in the case of a straight move between unknown variables, conversion is not done in order to preserve data integrity. There is an option to turn off the conversion of MOVE statements completely.
DO/ENDDO loops with counters are converted to FOR/ENDFOR loops.
In fixed-format, arithmetic operations (ADD, MULT, etc.) allow overflows to occur in the resulting field; in free-form, this is not permitted and can cause run-time errors. If this is encountered and overflow is the anticipated design, then the relevant section of code should be returned to fixed-format. If overflow was not the intended design, then the code should be manually converted to use an expression instead of individual opcodes.
Some opcodes require more operands in free-format than was allowed under fixed-format (e.g. LOOKUP can omit a result field, but the corresponding %lookup BIF cannot). Where this occurs and the converter cannot determine what was originally intended, the line is not converted and a comment is placed into the source to explain why it was not converted.