iSeries PGMREGEN Utility
There might be cases where one would need to re-create a bunch of programs, because of some file changes or because of some changes to the coding.
In absence of a re-compile stream, an utility able to find out the modules making up each single program would be of some help.
This utility should also be able to re-create non-ILE programs.

iSeries PGMREGEN Utility (library PGMREGEN) provides sample facilities to

  • retrieve the modules making up ILE programs
  • recreate ILE and non-ILE programs
This is done using some API's that provide documentation about program structure.

 Requirements 

  • OS/400 V4R5 or subsequent
  • all programs and modules to be re-created must be available along with their sources

 Commands 
Two commands are provided:

  1. rtvpgmmod (retrieve program modules)
                                           Retrieve program modules (RTVPGMMOD)
    Type choices, press Enter
    Program . . . . . . . . . . . . __________ Name, generic*, *ALL Library . . . . . . . . . . . *LIBL_____ Name, *LIBL, *CURLIB
    Run this command to retrieve all modules used by user-specified programs.
    Two output database files are created in library QTEMP:
    1. PGMS - This file lists all the programs retrieved. The following information is provided for each program:
      • Program name
      • Program library name
      • Activation group
      • User profile owning the program
      • Whether the program runs with USRPRF(*USER) or USRPRF(*OWNER)
      • Program attribute (High Level Language)
      • Source library name
      • Source file name
      • Source member name
    2. MODS - This file lists all modules making up the programs retrieved. The following information is provided for each module:
      • Program name
      • Program library name
      • Module name
      • Module library name
      • Module attribute (High Level Language)
      • Source library name
      • Source file name
      • Source member name
    These files can by used by user programs to perform various duties, e.g. program re-generation.
    Note 1. ILE programs display activation group, but do not display source information; source information is displayed in the related MODS records.
    Note 2. Non-ILE programs are also reported in file QTEMP/PGMS. They display no activation group, but display source information. There are no MODS records associated to them.

    Program . . . - Use this parameter to specify for which program(s) modules should be retrieved.
    Note 3. The programs do not necessarily have to be ILE programs. Non ILE programs will be listed in the QTEMP/PGMS file, but no corresponding module will be listed in the QTEMP/MODS file. See Note 2 above.

  2. pgmregen (regenerate programs)
                                           Regenerate programs (PGMREGEN)
    Type choices, press Enter
    Program . . . . . . . . . . . . __________ Name, generic*, *ALL Library . . . . . . . . . . . *LIBL_____ Name, *LIBL, *CURLIB Display log . . . . . . . . . . *YES *YES, *NO Target release . . . . . . . . . *CURRENT Character value
    Run this command to re-create all user-specified programs.

    Requirements:

    • All required programs must exist
    • For ILE programs made of modules,all modules must exist
    • All program / module sources must exist
    • The library list should be properly set to resolve file references.
    Note 1. A log of the regeneration actions is displayed on request (see parameter DSPLOG). Note 2. This command takes advantage of command PGMREGEN/RTVPGMMODS.

    This command may be convenient in cases where

    • No recompile stream is available
    • All programs and modules are available along with their sources
    • There is the need to re-create programs because of some database / device file changes or because of massive program / module changes.

    Program . . . - Use this parameter to specify the program(s) to be recreated.

    Display log . . . - Enter

    • *YES, to display the log of the actions taken and the related results
    • *NO, not to display such a log

    Target release . . . - Target release you want modules and programs be created (e.g. V5R2M0). Specify *CURRENT for your current OS/400 release.

 ... full sources provided! 

Full ILE-RPG and CL sources are provided, should you want to customize this utility for your own needs.

 To download this utility 
 

press