After taking a look at how Eclipse uses resources and the configuration options available in the IDE, you are going to see how to configure a project to locate copybooks that are not in the project directory. COBOL applications often consist of COBOL source files and copybooks that are not necessarily in the same location as the source files.
You are going to modify and configure the Hello COBOL World application which you created as part of the Eclipse Basic section to use a copybook which is part of another project. This is what you are going to do as part of this tutorial:
This creates the CopybookProj project in the same workspace and displays it in COBOL Explorer alongside the HelloCOBOLWorld project.
You need to create a program in your project to hold the COBOL source code:
This starts the New COBOL Copybook wizard.
This adds the copybook file to the project and opens it in the editor. Copybooks do not compile so the COBOL Copybook project type is not configured to build.
You are now going to add some code to the file from the HelloCOBOLWorld project.
display 'Hello COBOL World!'.
COPY Hello.cpy.
This starts a build that no longer compiles cleanly. There are some errors reported in the Output view and some error markers are added to the project in COBOL Explorer as well as in the editor.
In situations such as this, you need to check all of the error messages Eclipse reports. Then, you need to try and eliminate the causes for them one by one until the project compiles cleanly again.
Alternatively, hover the error marker (or any of the error markers) in the editor and see the error message in a tooltip. The error that is reported is that there is an unknown copybook.
This opens the Help view with the topic that corresponds to the error message. The reason for this problem is that Hello.cpy is unknown to the HelloCOBOLWorld project.
In order for HelloCOBOLWorld to recognize the copybook file, the project needs to have a dependency on the copybook project. Here's how you define the dependency:
You can click the tabs in this pane to see what settings you can specify on these pages.
This is the tab where you add other projects your project depends on.
This triggers a build of HelloCOBOLWorld and, because the project now locates the copybook, the build completes without any errors.
Preserve these projects because you are going to use them for a demonstration of how to debug an application.
Continue with the next section in this introduction to learn about what the development life cycle using Eclipse is.