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:
- Add the extensions manually to the IDE preferences - this creates a file association within the IDE that applies across any
- Add the copybook to a project and reference it from within a source file in the project using a COPY statement - this automatically
creates a file association in the IDE valid only within the current solution
Adding an extension to the IDE preferences
To manually configure the IDE to recognize a file extension as a COBOL copybook:
- In the IDE, click
Tools > Options, expand
Micro Focus COBOL, and then click
- Type the file extensions you want to associate with copybooks in the
Copybook extensions field using comma as a separator:
- Open the project's properties - click
- Click the
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:
- Add the copybook to a project in your solution:
- Right-click the project and click
Add > Existing Item.
- In the
Add Existing Item dialog box, set the
File extension filter to
All Files (*.*).
- Navigate to the folder that contains the copybook with a non-default extension, select the file and click
Alternatively, create a new copybook file with a non-default file extension in your project:
- Right-click your project and click
Add > New Item.
- In the
Add New Item dialog box, ensure
COBOL Items is selected in the pane on the left-hand side.
Copybook, specify a file name and a non-default extension, and click
This adds the new file to your project and loads it in the editor.
- Reference the copybook from within a source file:
- Open a source file in your project in the editor.
- 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.