Visual COBOL provides a number of demonstration applications
or programs for OpenESQL ODBC.
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 ODBC 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 source files for these samples are located in
$COBDIR/demo/openesql.
Each sample program comes with a
progName.txt file to explain how to use the program.
- catalog.cbl
- The file
catalog.cbl is an OpenESQL demonstration program that shows how to use the ODBC catalog functions from COBOL.
- 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
- 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.
- testconn.cbl
- The file
testconn.cbl
is an OpenESQL demonstration program that shows how to use different formats of the CONNECT and DISCONNECT statements.