Previous Topic Next topic Print topic

To specify that a file extension is a copybook

By default, the IDE is configured to recognize the following extensions as copybooks - .cbl, .cob, .cpf, .cpv, .cpy. If your copybooks use other extensions, you need to do one of the following to ensure the IDE recognizes the files as copybooks:

Adding an extension to the IDE preferences

To manually configure the IDE to recognize a file extension as a COBOL copybook:

  1. In the IDE, click Tools > Options, expand Text Editor, Micro Focus COBOL, and then click Advanced.
  2. Type the file extensions you want to associate with copybooks in the Copybook extensions field using comma as a separator: ext1,ext2.
  3. Click OK.
  4. Open the project's properties - click Project > MyProject Properties.
  5. Click the COBOL tab.
  6. Type copyext(ext1,ext2) in the Additional Directives field.

    This defines these specific extensions as copybooks for this particular project.

Automatically indicate that an extension is a copybook

To indicate that a file is a copybook within your solution:

  1. Add the copybook to a project in your solution:
    1. Right-click the project and click Add > Existing Item.
    2. In the Add Existing Item dialog box, set the File extension filter to All Files (*.*).
    3. Navigate to the folder that contains the copybook with a non-default extension, select the file and click Add.

    Alternatively, create a new copybook file with a non-default file extension in your project:

    1. Right-click your project and click Add > New Item.
    2. In the Add New Item dialog box, ensure COBOL Items is selected in the pane on the left-hand side.
    3. Click Copybook, specify a file name and a non-default extension, and click Add.

      This adds the new file to your project and loads it in the editor.

  2. Reference the copybook from within a source file:
    1. Open a source file in your project in the editor.
    2. Type a COPY statement and reference the copybook file with a non-default extension.

      This creates a file association for the copybook in the IDE which in turn enables background syntax checking and colorization for the file as well as all other features supported for copybooks.

      If the copybook is in a directory that is not part of the project, this also adds that folder to the Copybooks tab in the project's properties.

Previous Topic Next topic Print topic