Create the wrapper project

The BookWrapper.cbl interface has a similar interface to Book.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 will be Details.class and StatusGroup.class. This will be seen in action in the creation of the bridge code between the server code and the COBOL application.

Create the project

  1. Select File > New > COBOL JVM Project.
  2. Set Project Name to BookWrapper
  3. Click Finish.
  4. Open the project's Properties dialog box to set the compiler directives.
  5. Click Build Configuration then Apply. A Build Configuration tab will be displayed.
  6. In the Additional directives text box enter:
    ilnamespace(com.microfocus.bookwrapper) ilsmartlinkage ilcutprefix(lnk-b) ilcutprefix(lnk-) warnings(3)
  7. Click OK to finish.

Add the COBOL source files

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

  1. Right click on the src folder in COBOL Explorer and select Import > Import > General > File System.
  2. Click Next.
  3. Click Browse and navigate to <tutorial_source_folder>\BookWrapper\src.
  4. Click OK.
  5. Select src in the left-hand pane.
  6. Click Finish to 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. Select Micro Focus > JVM Build Path.
  3. Click on the Projects tab and click Add..
  4. Select COBOLBook and click OK.