Midware Ltd.

Converting to RPG IV

Home
Services
News
AS/400
Employment

Sign-up for e-mail notifications

Take our weekly poll

Dow Jones Intraday

Nasdaq Intraday

 

 

Because there are syntax differences, IBM has included the CVTRPGSRC command to automatically convert RPG III source code to RPG IV.  Before using this utility, you should create new source files (or change your existing ones) to have a record length of 112 bytes.  This is necessary  because the format of source records was changed to support expanded field names and op-codes.

Enter the CVTRPGSRC command in the following format:

CVTRPGSRC FROMFILE(library/source-file) FROMMBR(source-member)TOFILE(library/source-file) TOMBR(source-member)

The FROMFILE and FROMMBR parameters should indicate the old RPG III source file and member.  The TOFILE and TOMBR parameters should indicate the name and location where the generated RPG IV source code will be placed.

Note:  If this is the first time the CVTRPGSRC command has been run on your system, you may get an error message stating "Log file QRNCVTLG in library *LIBL not found".  If this is the case, either (a) use the Create Duplicate Object command (CRTDUPOBJ) command to copy the existing log file QARNCVTLG from library QRPGLE to a log file named QRNCVTLG in the library in your library list, or (b) specify LOGFILE(*NONE) on the CVTRPGSRC command.

When the command completes, you will have an RPG IV version of the program in the specified location.  Note that if you have any "/copy" statements in your program, the copy member(s) will also need to be converted.

The CVTRPGSRC command will simply convert your RPG III code line-by-line to RPG IV syntax.  It will not automatically update your code to use the enhanced RPG IV op-codes (such as Eval) .

Note:  There are third party conversion utilities on the market (reasonably priced) that will automatically convert your code to use some of the RPG IV language elements.  These utilities do a good job, but you should be careful, as there may be undesired effects when switching to the new RPG IV op-codes.  We'll cover some of these effects in the next few sections.

Start by converting a small, working program that you are familiar with and look at the results.  Use PDM option 14 to compile the program.  Notice that the command CRTBNDRPG (Create Bound RPG Program) is used instead of CRTRPGPGM (Create RPG Program).  This is a one-step compile process, as opposed to the two-step process we'll cover in the ILE section.  Your program should compile and run normally.

Now, go back to the original RPG III program and add a data-structure and a table or array.  Perform the conversion again and see how it converted those elements.


Before you proceed to the language element sections, there are a few important points you should know about the differences between ILE programs and Original Program Model (OPM) programs..

  Back to introduction Next to OPM vs. ILE 
 
Home Feedback Contents Search

Send mail to midware@midwareservices.com with questions or comments about this web site.
Copyright © 2000 Midware, Ltd.

Last Modified:  August 18, 2000