Previous Topic Next topic Print topic


To create a custom file template

You can create templates for any file type that Visual COBOL provides a new file wizard for.

Note: Using custom file templates is not supported for COBOL programs, COBOL JVM classes or interfaces in the COBOL JVM projects.

When you prepare a source file template, you can use a placeholder for the program name. This is replaced with the actual program name when you are using the template to create new files.

To prepare to use a file as a template:

  1. In the IDE, create a file of the desired file type in your project and type in it the required code.
  2. You can replace the program name in any source files with the following string <ProgramName>.

    This is a placeholder that will be replaced with the actual filename when you are using the file as a template.

  3. Save the file.

To save the file to a templates folder:

  1. On your file system, navigate to the project folder in your workspace.
  2. Copy and paste the file into a templates folder (such as /home/myfiletemplates (UNIX)).

Instead of saving the file in this way, you could export it from the IDE to your templates folder:

  1. In the IDE, select your project in COBOL Explorer.
  2. Click File > Export.
  3. In the Export dialog box, expand General, click File System, and then click Next.
  4. Ensure the check box for your project is enabled in the left-hand pane.
  5. In the right-hand pane only select the file you would like to use as a template.
  6. In the To directory field, specify the path to your dedicated templates folder (such as /home/myfiletemplates (UNIX)).
  7. Click Finish.

    This saves the file to your templates folder.

Note: It is a good practice to use a single folder to store all of your templates. You can use any subfolder structure within that location. When you want to use the templates, you need to configure the IDE preferences to search for templates in the templates folder. The IDE will scan all subfolders of the templates folder, and will display the relevant project and file types in a tree structure.
Previous Topic Next topic Print topic