Create the wrapper project

The BookWrapper.cbl interface has a similar interface to BookLegacy.cbl but updated to turn the file status into a string and a numeric value, and pass it back in lnk-status-group. The setup-status section does the conversion.

procedure division using by value lnk-function by reference lnk-b-details lnk-status-group. 

The BookWrapper.cbl program is compiled with the ILSMARTLINKAGE directive which creates classes to represent the PROCEDURE DIVISION parameters. In the bin folder are the Details.class and StatusGroup.class files. These files are used in the creation of the bridge code between the server code and the COBOL application.

Create the project

To create the wrapper project:

  1. In the COBOL perspective, click File > New > COBOL JVM Project.

    This opens the New COBOL JVM Project dialog box.

  2. In the Project name field, type BookWrapper
  3. Click Finish.

    To set the compiler directives:

  4. Right-click the BookWrapper project, and then click Properties.

    This opens the Properties for BookWrapper dialog box.

  5. Click Micro Focus > Build Configuration.
  6. In the Additional directives field, type:

    ilnamespace(com.microfocus.bookwrapper) ilsmartlinkage ilcutprefix(lnk-b) ilcutprefix(lnk-) jvmdecimal(scaledinteger) warnings(3)

  7. Click Apply and Close.

Add the COBOL source files

The project uses one source file, BookWrapper.cbl, that needs to be imported into your project:

  1. In the COBOL Explorer, expand the BookWrapper project, and then right-click src.
  2. Click Import > Import.

    This opens the Import dialog box.

  3. Click General > File System.
  4. Click Next.
  5. Next to the From directory field, click Browse and navigate to <tutorial_source_folder>\BookWrapper\src.
  6. Click OK.
  7. Check src in the left pane.
  8. Click Finish.

    This import the files into the project.

Set the copybook path

The copybook path needs to be set to point to the CobolBook project:

  1. Open the BookWrapper project's Properties dialog box.
  2. Click Micro Focus > JVM Build Path.
  3. Click the Projects tab, and then click Add.

    This opens the Required Project Selection dialog box.

  4. Check CobolBook, and then click OK.
  5. Click Apply and Close.