Previous Topic: Compatible Names Between HLLs

Next Topic: Converting from COBOL to RPG

Converting from RPG to COBOL

To convert a model to COBOL:

  1. If you plan to create more files, fields, or functions, use the YCHGMDLVAL command to change the following model values.

YCHGMDLVAL MDLVAL(YHLLGEN) +
 VALUE(*CBL)

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.

  1. 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)

  1. 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)

  1. 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)

  1. 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)

  1. 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.

  2. 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:

    Note: The model value YHLLCBL determines whether you generate COBOL/74 or COBOL/85.

  3. Generate and compile as follows:

For more information: