Previous Topic Next topic Print topic


The Demonstration Program

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

After your installation and setup are complete, you may run the demonstration program (demo.cbl), which can be found in the Connectors sub-directory within your Samples (Windows) or $COBDIR/demo (UNIX) directory. This program illustrates many of the Database Connectors product capabilities, including how to:

The demo program simulates what might be used in a distributor’s shipping department. You'll create a table named orderfile, which contains information about the orders placed by the distributor's customers. The orderfile table has the following columns of information (the database data type and COBOL data type are shown for each).

Note: The data type may be slightly different depending on your RDBMS.
Column Name Data Type COBOL PIC
ORDER_NUM CHAR(4) pic x(4)
ORDER_DATE DATE pic 9(6)
CUSTOMER_NUM      CHAR(3) pic x(3)
SHIP_INSTRUCT CHAR(40) pic x(40)
BACKLOG CHAR(1) pic x
PO_NUM CHAR(10) pic x(10)
SHIP_DATE DATE pic 9(6)
SHIP_WEIGHT NUMBER(8,2) pic 9(6)v99
SHIP_CHARGE NUMBER(6,2)      pic 9(4)v99
PAID_DATE DATE pic 9(6)

Here is the COBOL file descriptor (FD) that matches the orderfile table. Note that the FD entries must match the names of the RDBMS fields and must match their data types:

fd  orders.
01  order-record.
    03  order-num              pic x(4).
    03  order-fields.
        05  order-date         pic 9(6).
        05  customer-num       pic x(3).
        05  ship-instruct      pic x(40).
        05  backlog            pic x.
        05  po-num             pic x(10).
        05  ship-date          pic 9(6).
        05  ship-weight        pic 9(6)v99.
        05  ship-charge        pic 9(4)v99.
        05  paid-date          pic 9(6).
Tip: Database Connectors creates new tables in a target database when your COBOL application issues an OPEN OUTPUT command. If you turn on file tracing for a COBOL program that performs this operation on a target file, you can see the series of SQL statements generated by the run time system to create the database table, indexes, and access permissions. This can be useful should you wish to have a set of stand-alone SQL scripts to generate test databases or base set of tables for an end user install for your COBOL files to work with.
Previous Topic Next topic Print topic