Set Up the ProgramRESTAPI Project

Walks you through the process of creating a Visual COBOL project for the CarsProgram demonstration application, and populating the project with demonstration files.
Restriction: This topic applies only when the Enterprise Server feature is enabled.

Create the ProgramRESTAPI project

  1. In Eclipse, click File > New > COBOL Project.
  2. In the Project name field, type ProgramRESTAPI.
  3. Check Use default location; then click Finish.

    The COBOL Explorer now shows the ProgramRESTAPI project.

Set build configuration properties ProgramRESTAPI

Before Eclipse builds this project, you want to set several configuration options to ensure that all required files are generated, are in the correct output format, and are located in specific folders.

Add additional directives
First, you need to add some additional compiler directives that generate an XML mapping file and required Web service files.
  1. In the COBOL Explorer, right-click the ProgramRESTAPI project, and then select Properties from the context menu.
  2. Expand Micro Focus > Build Configurations, and then click COBOL.
  3. In the right pane, check Enable configuration specific settings.
  4. Click in the Additional directives field, and then click the browse button browse.
  5. On the Additional directives dialog box, type:
    xmlgen(loadlib) xmlgen(ws)
    Note: loadlib is the name of your output path, which you set in the next section.
  6. Click OK to close the dialog box, and then click Apply.
Set output options
Next, you need to set your output path and target type.
  1. In the left pane, click Link.
  2. In the right pane, replace the New Configuration.bin value in the Output Path with loadlib, and then press Enter.
  3. In the the Target Type drop-down list, select All Native Library Files.
  4. Click Apply and Close to save your configuration changes.

    This action automatically creates the loadlib subdirectory in your project.

Add CarsProgram demonstration files to the project

Import COBOL source
  1. From the COBOL Explorer, right-click the ProgramRESTAPI project and select Import > Import from the context menu.

    This opens the Import dialog box.

  2. Expand General and click File System.
  3. Click Next.
  4. Click the Browse button that corresponds to the From directory field, and browse to the %PUBLIC%\Documents\Micro Focus\Visual COBOL\Samples\Interface Mapping Toolkit\ServiceInterfaces\CarsProgram directory.
  5. Click Select Folder.
  6. On the list of files, check just the CarsProgram.cbl and the cars.cpy files.
  7. Click Finish.

    This adds the source files to the project, builds the project automatically, and places the output files into the loadlib output directory.

Import cars.xml
Now you can import the cars.xml data file directly into the new loadlib output directory:
  1. In the COBOL Explorer, expand the loadlib node.

    Here you can see the output files generated by the build, including CarsProgram.xml file that maps COBOL data fields to XML.

  2. Right-click the loadlib node, and then select Import > Import from the context menu.
  3. Expand General and click File System.
  4. Click Next.
  5. Click the Browse button that corresponds to the From directory field, and browse to the %PUBLIC%\Documents\Micro Focus\Visual COBOL\Samples\Interface Mapping Toolkit\ServiceInterfaces\CarsProgram directory.
  6. Click Select Folder.
  7. On the list of files, check just the cars.xml file.

    Because you accessed the Import wizard from the loadlib node in your project, the Into folder field is populated with the path to your output directory.

  8. Click Finish.