Generating Copybooks

RPG programs and COBOL programs that execute in the AS/400 environment often use copy statements that reference Database Description or Device Description files rather than copybooks. MCP COBOL programs occasionally use copy statements that reference DMSII DASDL files. If your application uses copy statements to reference these types of files, you need to verify the files and generate copybooks for the application before you verify program files.

Copybook generation takes place in two steps:

  • For each database and device file object generated at verification, the system creates a target copybook object.
  • For each target copybook object, the system creates one or more physical copybooks.

Settings on the Generate Copybooks tab of the Project Options window determine conversion behavior. The default values should be appropriate for most installations.

  1. Verify:
    • Database Description files. For each Database Description file, the system creates a database file object with the same name as the Database Description file.
    • Device Description files. For each Device Description file, the system creates a device file object with the same name as the Device Description file.
    • DMSII DASDL files. For each DMSII DASDL file, the system creates a DMSII database file object with the same name as the DMSII DASDL file.
  2. In the Repository Browser, select the project, database file, or device file and choose between:
    • Prepare > Generate RPG Copybooks for Project for RPG.
    • Prepare > Generate Copybooks for Project for AS/400 COBOL or MCP COBOL.
    Note: Skip this step for MCP Cobol if you selected Generate After Successful Verification on the Generate Copybooks tab of the Project options window.

    The system creates a target copybook for each database or device file object, with a name of the form database file.DBCOPYBOOK or device file.DVCOPYBOOK, in the Target Copybooks folder.

  3. The system automatically converts the target copybooks to physical copybooks if you selected Convert Target Copybooks to Legacy Objects on the Generate Copybooks tab of the Project options window. If you chose not to convert target copybooks automatically, select the target copybooks and choose Prepare > Convert to Legacy. The system generates physical copybooks with names of the form DD_OF_database file.CPY or DV_OF_device file.CPY.
    Note: After generating copybooks, you can generate screens for AS/400 COBOL device file objects by selecting the objects in the Repository Browser and clicking Prepare > Generate Screens.