Preparing for Generation and Compilation › HLL Implementation Considerations › Converting from RPG to COBOL
Converting from RPG to COBOL
To convert a model to COBOL:
- If you plan to create more files, fields, or functions, use the YCHGMDLVAL command to change the following model values.
- Generation Type for new functions, using the command string:
YCHGMDLVAL MDLVAL(YHLLGEN) +
VALUE(*CBL)
- HLL(s) naming convention for new names, using command string:
YCHGMDLVAL MDLVAL(YHLLVNM) +
VALUE(*RPGCBL)
Note: If you think you might ever create objects in both RPG and COBOL, set the model value YHLLVNM to *RPGCBL.
If your model was initially created with the naming convention set to *RPGCBL, skip steps 2, 3, and 4.
- Replace the generation type data in your model library with the COBOL generation types. To replace the data, enter:
CPYF +
FROMFILE(2E-NL-library/YGENTYPPDP) +
TOFILE(your-model/YGENTYPRFP) +
FROMMBR(CBL) TOMBR(*FIRST) +
MBROPT(*REPLACE)
To find out the National Language library (2E-NL-library) name, enter:
DSPDTAARA +
DTAARA(2E-product-library/YLNGxxxSYA)
- Replace the device format data in your model with COBOL formats. To replace the data, enter:
CPYF +
FROMFILE(2E-NL-library/YDEVFMTPDP) +
TOFILE(your-model/YDEVFMTRFP) +
FROMMBR(CBL) TOMBR(*FIRST) +
MBROPT(*REPLACE)
- For existing functions and files, run the Convert Model Names (YCVTMDLVNM) command before regenerating them in COBOL. This command changes existing names to valid COBOL names and creates a report of old names and corresponding new names. To rename function and file names, enter:
YCVTMDLVNM MDLLIB(your-model-library)
- Add the COBOL library, Y2SYCBL, to your model and model job description library lists. Be sure to exit and save the changes and update the batch job description. To add the library, enter:
YEDTLIBLST LIBLST(your-model-library/*JOB)
- Delete previously submitted items from the job list for Submit Create Requests from Model (YSBMMDLCRT). You cannot change the source type of a function already on the list.
For more information on deleting items from job lists, see the Using Job Lists section in this chapter.
- Change the source type of existing functions to CBL. Enter the model and change the source type. Use either of the following methods to display the Edit Function Details panel:
- Go to the Display Services Menu and select the Display all functions option. Zoom into each named object on the list.
- On the Edit Model Object List panel specify option 2 for each function on the All Objects list (*ALLOBJ).
Note: The model value YHLLCBL determines whether you generate COBOL/74 or COBOL/85.
- Generate and compile as follows:
- If the access path format names begin with @, the RPG default, generate and compile all access paths as well as functions. This changes the RPG @ prefix to a COBOL prefix.
- If you have created a set of access paths with COBOL compatible names, generate and compile only the functions.
For more information:
- On implementation names, see the Administrator Guide.
- On CA 2E commands, see the Command Reference Guide.
- On recompiling physical files, see the chapter titled "Generating and Compiling Your Application" in this guide.
- On editing the All Objects list, see the chapter titled "Managing Model Objects" in this guide.