Create a Project and Import Your Sources

Once you have ensured your programs compile cleanly in the Visual COBOL environment, you can create a project for them so that you can take full advantage of all of the benefits offered by the Eclipse debugging environment. You need Visual COBOL for Eclipse installed on your local Windows machine and you need to create a connection in it to the remote UNIX machine.

Connect Visual COBOL to the remote machine

From your local installation of Visual COBOL create a new remote connection to Visual COBOL Development Hub on the UNIX machine which has your existing COBOL programs. See Creating connections to remote hosts in this product help.

Create a remote project

You need to create a project that will store the source files on the remote machine:

  1. Start Visual COBOL.

    If this is the first time you have started Visual COBOL you see the Welcome page in the IDE. You can also open the Welcome page by clicking Help > Welcome.

  2. Click Open COBOL perspective in the Welcome page.

    In this perspective, Eclipse offers you the views and commands that are best suited for COBOL development.

  3. Click File > New > Remote COBOL Project.

    Choose the remote connection to use and follow the instructions to create a remote native COBOL project in a directory on the remote machine.

Import the COBOL source files

Add the source files on the remote machine to your project as follows:

  1. Right-click your project in the COBOL Explorer view and click Import > Import.
  2. In the Import wizard, expand General, click File System, and then click Next.
  3. Click Browse, navigate to the location of your source files on the remote machine, and click OK to confirm the path.
  4. In the Import wizard, enable the check boxes for the files you want to import in your project, and click Finish.

    This adds the files to your project and, if Eclipse uses the default settings, starts a build. You might need to set some Compiler directives to resolve any compilation issues, similarly to when you resolved any issues when compiling from a terminal window.

Configure your project

To configure your project and specify any Compiler directives:

  1. Right-click your project in COBOL Explorer, and click Micro Focus > Project Settings > COBOL.
  2. In the Additional directives field, specify any directives that you had to use to resolve any issues that occurred when you compiled without a project. These could be the Compiler directives that were used to compile the application in Server Express prior to the upgrade or new ones.
  3. Also specify the following Compiler directives:
    • SOURCETABSTOP"8"
    • COPYEXT",CBL,CPY"

    If your source code contains tab stops, compilation might fail, because although a COBOL tab is eight characters long, the IDE's tab is four characters long, and lines of code might be starting in the sequence number and indicator areas section (columns one to seven) of the program instead of from column eight.

    You can fix this problem using the SOURCETABSTOP(n) Compiler directive, where n is the number of space characters by which to expand tab characters during compilation.

  4. Click OK.

Build the project

By default, Eclipse builds your source files each time you make a configuration change or add or edit the files. If you have changed this preference, to build the project click Project > Build Project.

Add copybooks

To add existing copybooks to your project, right-click the project and use the Import > Import command.

Copybooks are not compiled at build time and the files' Build Action property is automatically set to None. (You can also set this property for COBOL source files to keep a file in the project but not include a built version in any output.)

By default, Visual COBOL identifies files as copybooks by their .cpy extension. You can specify other file extensions as copybooks in the IDE preferences - click Window > Preferences > Content Types, click COBOL Copybook and add any new file associations using this dialog box.