To compile and run the demo program

Restriction: This topic applies only when a Database Connectors license has been installed via the Micro Focus License Management System.

Before you compile the demo program, ensure that your RDBMS data source is available and correctly configured. The demo program (demo.cbl) by default is located in the Connectors sub-directory within your $COBDIR/demo directory.

  1. From a Visual COBOL command or shell prompt, set the environment variable A_CONFIG to the path of your ACUFH configuration file.
    Note: See the specific RDBMS sections for details of the variables your configuration file should contain as a minimum requirement. You do not need to add the variables for user name and password, as these are prompted for when the program runs.
    A_CONFIG=/path/to/myconfig.cfg
    export A_CONFIG
  2. Enter the compilation command:
    cob demo.cbl IDXFORMAT"nn";

    where nn is either 18 (for MSSQL), 19 (for Oracle) or 20 (for DB2).

    Note: The CREATEXFD directive is also a minimum requirement, but this is explicitly specified within the program.

    An executable file (demo.int) and an XFD file (orderfile.xfd) is built.

  3. After compilation, run the program:
    cobrun demo.int
    Note:

    If you are not running the executable from the same directory as the XFD file, you will also need to add XFD_PREFIX path/to/xfd-file to your ACUFH configuration file.

    On HP-UX platforms, you must use the cobrun_t syntax so that your application and the RDBMS both use a multi-threaded run time system; a mix of single- and multi-threaded run time systems will produce an error.

  4. When prompted, enter a valid username and password for your RDBMS.
  5. When the following screen appears, use A)dd to add a new record.


    Demo screen

    When you save the record, it is written to a new table (orderfile) within the database specified in the ACUFH configuration file.

  6. Press Q)uit to end the demo program.