The Demonstration Program

As soon as your installation and setup are complete, you may run the demonstration program (demo.cbl) included on your distribution medium. 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 be creating the orderfile table, 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).

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

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).

First compile the demo program, demo.cbl, using standard compile commands. The demo.cbl program contains compiler directives at the top of the program to generate an eXtended File Descriptors (XFD) file called orderfile.xfd and to specify using the ACUFH file handler. (For information about XFDs, see the chapter XFDs.) You may also specify these directives on your compile command line. The run-time system will use this XFD to map RDBMS data types to COBOL data types.

As an alternative to using the demo program to create tables, Database Connectors will create new tables in the 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.