Previous Topic Next topic Print topic


To create a Visual Studio Solution

In this topic, you create a Visual Studio solution for your COBOL application. You then use the compiler to compile the COBOL application to generate an “eXtended File Descriptor” (XFD). The XFD is used to map your data from the record-oriented COBOL application to a relational database’s column-oriented format.

  1. In Visual Studio, click File > New > Project > COBOL Projects > Native > Console Applications.

    The new project generates a template program called program1.cbl that is not needed. You may want to delete it.

  2. Create a new project called dbsample in a directory of your choice.
  3. In Solution Explorer, double-click in Properties and ensure that the following options are set in the Application, COBOL, and Debug tabs:
    Application Tab Output type: Console Application
    COBOL Tab Native

    COBOL dialect: Non-mainframe

    Link settings

    • Run-time Library
      • [x] Shared
    • Thread Model
      • [x] Multi-threaded
    • Linker Parameters
      • Link with objs: "C:\Program Files\Micro Focus\Studio Enterprise Edition 6.0\Base\Lib\FHRSUB.OBJ"
      • [x] Include system programs

        If you don't check this, you don't need to link with fhrsub.ob

    Debug Tab Start Options
    • Working directory: <location of xfd file> (for example, c:\myproject\xfd).
  4. In Solution Explorer, right-click in the dbsample project name.
  5. Click Add > Existing Item.
  6. Browse to the following subdirectory in the samples, Examples\Database Connectors, and add the sample program order1.cbl.
  7. Open the order1.cbl program.

    Notice that to instruct the compiler to generate the XFD file, you use at the beginning of the COBOL program the following directive:

    $SET CREATEXFD

    If you want the XFD files to be placed in a different directory from the current one, you can use the following format:

    $SET CREATEXFD(XFD-DIRECTORY=c:\myproject\xfd)

    This directive can also be set using the project’s properties. To do this, double-click on the project’s Properties, click on the COBOL tab, and in the Additional Directives entry field type CREATEXFD. Save the changes.

  8. Build your project.

    The compiler creates the purch1.xfd file in your current XFD directory.

Previous Topic Next topic Print topic