Previous Topic Next topic Print topic


Demonstration Applications

A number of ODBC demonstration applications are supplied in the $COBDIR/demo/sql/openesql directory by default.

Each sample application comes with a README.txt file to explain how to use the application, and a makefile.

Before you can use any of the demonstration applications, you need to have installed at least one ODBC driver, and created DSNs to use with the demonstrations.

Some of the demonstration applications expect that a table called EMP exists on the database to which you are connecting.

The OpenESQL demonstration applications all produce a console log displaying their progress and, possibly, query results. They all terminate on receipt of an error, after displaying an error message.

The following applications are provided:

  • testconn.cbl

    The file testconn.cbl is an OpenESQL demonstration program that shows how to use different formats of the CONNECT and DISCONNECT statements.

  • catalog.cbl

    The file catalog.cbl is an OpenESQL demonstration program that shows how to use the ODBC catalog functions from COBOL.

  • static.cbl

    The file static.cbl is an OpenESQL demonstration program that shows how to use basic SQL functions from COBOL. It demonstrates the use of INSERT, UPDATE, DELETE, SELECT INTO and SELECT using a cursor. It also shows the use of COMMIT and ROLLBACK.

  • dynquery.cbl

    The file dynquery.cbl is an OpenESQL demonstration program that shows how to use dynamic SQL functions from COBOL. It provides the capability for the user to enter any SQL statement and the program will execute them. It shows how to prepare a SQL statement and how to use the SQLDA structure to retrieve data from columns when the type of the column is not known when the program is compiled.

    If you are accessing the EMP table described above, a sample query would be:

    select FIRST_NAME, LAST_NAME, HIRE_DATE, SALARY from EMP
Previous Topic Next topic Print topic