Top
NetCOBOL V11.0 NetCOBOL Studio User's Guide
FUJITSU Software

6.2.3 Creating a COBOL program by using the precompiler

To develop COBOL programs including input sources for the precompiler from creating new project, the "Build Tools" settings can be set automatically if Use precompiler is checked in the New COBOL Project wizard.

To specify the Build Tools for the precompiler to the existing COBOL project:

  1. Adding the precompiler to "Build Tools".

  2. Setting precompiler link information.

  3. Creating and adding precompiler input sources.

6.2.3.1 Build tool settings

To invoke the precompiler during build for a COBOL project, Precompiler must be set for Build Tools.

Adding Precompiler to build tools

If Precompiler is not specified for the Build Tools, follow the procedure below, and select Precompiler.

  1. Select the project in the "Dependency" or "Structure" view.

  2. Select "Property..." from the context menu. The property dialog box appears.

  3. Select "Build Tools" in the left pane. The "Build Tools" page is displayed.

  4. Click the "Add Build Tool..." button. The "Add Build Tool" dialog box appears.

  5. Select "Precompiler", and then click the "OK" button.

Confirm that Precompiler has been added to the "List of build tools associated with COBOL Builder" on the "Build Tools" page, and then click the "OK" button in the property dialog box.

Deleting Precompiler from build tools

To delete Precompiler from a COBOL project:

  1. Select the project from the "Dependency" or "Structure" view.

  2. Select "Property..." from the context menu. The property dialog box appears.

  3. Select "Build Tools" in the left pane. The "Build Tools" page is displayed.

  4. Select "Precompiler "from "List of build tools associated with COBOL builder" on the "Build Tools" page, and click the "Remove" button.

  5. Confirm that Precompiler has been deleted from "List of build tools associated with COBOL builder", and click the "OK" button in the property dialog box.

Note

If a precompiler input source is registered in the "Source Files" folder, Precompiler cannot be deleted from "Build Tools". Delete the precompiler input source from the "Source Files" folder before deleting Precompiler from "Build Tools".

6.2.3.2 Setting and changing precompiler link information

Information can be set and changed for the precompiler command used to build COBOL projects. Existing precompiler link settings are used as the defaults.

Setting and changing precompiler link information

Follow the procedure below to set or change precompiler information for a COBOL project.

  1. Select the project in the "Dependency" or "Structure" view.

  2. Select "Property..." from the context menu. The property dialog box appears.

  3. Select "Build Tools" > "Precompiler" in the left pane. The "Precompiler" page is displayed.

Example

Examples of settings for the Oracle precompiler

  INAME=%INFILE% ONAME=%OUTFILE%Description 

For details on the "Precompiler" page, see "6.2.1 Setting and changing initial values of precompiler link information".

Note

If a precompiler input source is registered in the "Source Files" folder, no change can be made in "Precompiler source extension" on the "Precompiler" page. Delete the precompiler input source from the "Source Files" folder before making a change in "Precompiler source extension".

6.2.3.3 Creating and adding a precompiler input source

To add a precompiler input source to a project, precompiler link information must be set in the project in advance. The precompiler input source must be registered in the Source Files folder of the COBOL project. The following two methods can be used to register a precompiler input source in the Source Files folder:

Creating a precompiler input source and registering the new source in the Source Files folder

To create a precompiler input source and register the new source in the "Source Files" folder, use the COBOL Source generation wizard or the Object-Oriented COBOL Source generation wizard. Check the "Use precompiler" check box on the first page of the wizard. Then, the created COBOL source or object-oriented COBOL source is registered as a precompiler input source in the "Source Files" folder.

To start the wizard:

  1. In the "Dependency" or "Structure" view, select the Source Files folder of the COBOL project.

  2. Select "File" > "New" > "COBOL Source" or "Object-Oriented COBOL Source" from the menu bar, or select "New" > "COBOL Source" or "Object-Oriented COBOL Source" from the context menu. The wizard is started.

Note

If no precompiler link information is set for the project, the check box for "Use precompiler" is disabled. Set the precompiler link information, and then restart the wizard.

Registering an existing precompiler input source in the Source Files folder

An existing precompiler input source can be registered in the "Source Files" folder of a COBOL project.

Note

If no precompiler link information is registered for the project concerned, an error occurs. The file is registered in the Source Files folder, but it is not registered as a precompiler input source. In this state, even if precompiler link information is set for the project, the file added by the above operation is not automatically registered as a precompiler input source. Move it from the Source Files folder to the Other Files folder then register the file in the Source Files folder again.

6.2.3.4 Editing a precompiler input source

To edit the contents of a precompiler input source with the COBOL editor, the extension of the precompiler input source file must be associated with the Content Types and COBOL editor. The association is invoked automatically when the Precompiler setting is set. If the precompiler input file is not opened by the COBOL editor, follow the procedure below and associate the file extension with the Content Types and COBOL editor.

  1. Select "Window" > "Preferences" from the menu bar. The "Preferences" dialog box appears.

  2. In the left pane of the "Preferences" dialog box, select "General" > "Content Types". This displays the "Content Types" page.

  3. In the "Content Types" page, select "Text" > "COBOL Source File".

  4. Click the "Add" button, The "Add Content Type Association" dialog box displays.

  5. In the "Add Content Type Association" dialog box, enter the extension of the precompiler input source file at "Content type" and click the "OK" button.

  6. In the "Content Types" page, check that the extension of the precompiler input source file is displayed at "File associations", and click the "OK" button.

  7. Select "General" > "Editors" > "File Associations" in the left pane of the "Preferences" dialog box. The "File Associations" page is displayed.

  8. Click the "Add..." button to the right of File types on the "File Associations" page. The "Add File Type" dialog box appears.

  9. Enter the extension of the precompiler input source file in "File type" in the "Add File Type" dialog box, and click the "OK" button. The specified extension is added to "File types" on the "File Associations" page.

  10. Select the added extension from "File types" on the "File Associations" page, and click the "Add..." button to the right of "Associated editors". The "Editor Selection" dialog box appears.

  11. Confirm that Internal Editors is selected in the "Editor Selection" dialog box, and select "COBOL Editor".

  12. "COBOL Editor" is added to "Associated editors" on the "File Associations" page.