CIS 3713
Converting from RPG/400 to RPG IV
OS/400 v3r2 provides a utility program that facilitates the migration from RPG/400 to RPG IV. This utility program, CVTRPGSRC, converts the member source file of a syntactically correct RPG/400 program into a new member source file that can be compiled under RPG IV.
Before using the CVTRPGSRC utility to convert an RPG/400 source file to an RPG IV source file, you must take some preparatory steps. This document will provide you with a systematic procedure to ensure your success at this conversion process.
Preparing a Source Physical File for Your RPG IV Programs
You will first need to create a new source physical file, which will serve to hold your new RPG IV member source files. Normally, you will need to execute this process only once.
From the command line, issue the create source physical file command: CRTSRCPF <enter>
MAIN AS/400 Main Menu
System: S1010045
Select one of the following:
1. User tasks
2. Office tasks
4. Files, libraries, and folders
6. Communications
8. Problem handling
9. Display a menu
10. Information Assistant options
11. Client Access tasks
90. Sign off
Selection or command
===> CRTSRCPF
You will next see the following screen. On this screen, you will:
1. Enter the QRPGLESRC as the File name of the new physical source file.
2. Make sure Library is *CURLIB
3. Change the Record length from 92 to 112.
4. Change Text ‘description’ from *BLANK to RPG IV SOURCE FILES
Create Source Physical File (CRTSRCPF)
Type choices, press Enter.
File ...... Name
Library ...... *CURLIB Name, *CURLIB
Record length ...... 92 Number
Member, if desired ...... *NONE Name, *NONE, *FILE
Text 'description' ...... *BLANK
Bottom
Your screen should now look similar to this. When it does, hit the <enter> key to proceed.
Create Source Physical File (CRTSRCPF)
Type choices, press Enter.
File ...... QRPGLESRC Name
Library ...... *CURLIB Name, *CURLIB
Record length ...... 112 Number
Member, if desired ...... *NONE Name, *NONE, *FILE
Text 'description' ...... RPG IV SOURCE FILES
Bottom
Congratulations, You have successfully created your new source physical file!
Running the CVTRPGSRC Utility Program
After successfully creating your new source physical file (which will hold the newly converted RPG IV member source files) you are now ready to convert your RPG/400 source files to RPG IV. Remember: your RPG/400 source files that you want to convert to RPG IV must be syntactically correct (i.e. free of compiler errors) before executing the CVTRPGSRC utility.
In this example, we will convert an RPG/400 member source file named MYPROG, into an RPG IV member source file named MYPROG. The RPG/400 member source file is assumed to reside in your current library (*CURLIB) in a source physical file named QRPGSRC. The converted RPG IV source file MYPROG, will reside in your current library (*CURLIB) in a source physical file name QRPGLESRC.
To start the CVTRPGSRC utility, from the command line type: CVTRPGSRC <enter>
MAIN AS/400 Main Menu
System: S1010045
Select one of the following:
1. User tasks
2. Office tasks
4. Files, libraries, and folders
6. Communications
8. Problem handling
9. Display a menu
10. Information Assistant options
11. Client Access tasks
90. Sign off
Selection or command
===> CVTRPGSRC
You should now see the following screen. Next, press the F10 key to display additional parameters.
Convert RPG Source (CVTRPGSRC)
Type choices, press Enter.
From file ...... Name
Library ...... *LIBL Name, *LIBL, *CURLIB
From member ...... Name, generic*, *ALL
To file ...... QRPGLESRC Name, *NONE, QRPGLESRC
Library ...... *LIBL Name, *LIBL, *CURLIB
To member ...... *FROMMBR Name, *FROMMBR
F3=Exit F4=Prompt F5=Refresh F10=Additional parameters F12=Cancel
F13=How to use this display F24=More keys
Your display will now look similar to the screen image below. You will now make several entries on this screen.
- Enter QRPGSRC as the “From file”.
- Change the “From Library” to *CURLIB
- Enter MYPROG as the “From member”
- Change the “To Library” to *CURLIB
- Change the entry in the “Log file” to *NONE
- Delete the “Log file Library” entry (fill entry with blanks)
Convert RPG Source (CVTRPGSRC)
Type choices, press Enter.
From file ...... Name
Library ...... *LIBL Name, *LIBL, *CURLIB
From member ...... Name, generic*, *ALL
To file ...... QRPGLESRC Name, *NONE, QRPGLESRC
Library ...... *LIBL Name, *LIBL, *CURLIB
To member ...... *FROMMBR Name, *FROMMBR
Additional Parameters
Expand copy member ...... *NO *NO, *YES
Print conversion report . . . . *YES *YES, *NO
Include second level text . . . *NO *NO, *YES
Insert specification template . *NO *NO, *YES
Log file ...... QRNCVTLG Name, *NONE, QRNCVTLG
Library ...... *LIBL Name, *LIBL, *CURLIB
Log file member ...... *FIRST Name, *FIRST, *LAST
Bottom
F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display
F24=More keys
Your display will now look similar to the screen image below. If it does, you are now ready to convert your source file from RPG/400 to RPG IV. Just press the <enter> key. Note: you may have to hit <enter> twice.
Convert RPG Source (CVTRPGSRC)
Type choices, press Enter.
From file ...... QRPGSRC Name
Library ...... *CURLIB Name, *LIBL, *CURLIB
From member ...... LAB31 Name, generic*, *ALL
To file ...... QRPGLESRC Name, *NONE, QRPGLESRC
Library ...... *CURLIB Name, *LIBL, *CURLIB
To member ...... *FROMMBR Name, *FROMMBR
Additional Parameters
Expand copy member ...... *NO *NO, *YES
Print conversion report . . . . *YES *YES, *NO
Include second level text . . . *NO *NO, *YES
Insert specification template . *NO *NO, *YES
Log file ...... *NONE Name, *NONE, QRNCVTLG
Library ...... Name, *LIBL, *CURLIB
Log file member ...... *FIRST Name, *FIRST, *LAST
Bottom
F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display
F24=More keys
If all goes right, the system will return a message similar to the one on the screen capture below – notifying you that member MYPROG was added to you file QRPGLESRC, in your current library.
Work with All Spooled Files
Type options, press Enter.
1=Send 2=Change 3=Hold 4=Delete 5=Display 6=Release 7=Messages
8=Attributes 9=Work with printing status
Device or Total Cur
Opt File User Queue User Data Sts Pages Page Copy
MYPROG STARASZE QPRINT RDY 8 1
Bottom
Parameters for options 1, 2, 3 or command
===>
F3=Exit F10=View 3 F11=View 2 F12=Cancel F22=Printers F24=More keys
Member MYPROG added to file QRPGLESRC, library STARASZE.
Compiling the Converted Source File
Your new RPG IV member MYPROG, added to file QRPGLESRC in your current library, can now be compiled using Option 14 in the Program Development Manager (PDM).