Demonstration Applications

Enterprise Developer provides a number of demonstration applications or programs for HCO for DB2 LUW and the DB2 ECM. On Windows platforms, you can access these via the Mainframe and Visual COBOL Samples Browsers. For instructions on how to start either Samples Browser, see To start the Samples Browser.

HCO for DB2 LUW – Windows Environment

All HCO for DB2 LUW samples are listed on the Show unmanaged only list in the Mainframe Samples Browser.

The source files are located in subdirectories under %PUBLIC%\Documents\Micro Focus\Enterprise Developer\Samples\Mainframe\SQL\HCO for DB2 LUW.

Each sample application comes with a Readme file to explain how to use the application.

HCO for DB2 LUW - Getting Started
Demonstrates the functionality of Host Compatibility Option, including: Database creation; DDL processing; Import; Export; DCLGEN; Using Static SQL statements; Using Dynamic SQL statements.
HCO for DB2 LUW - BindAll
Demonstrates how to write bind (.bnd) files to a different directory using DB2(BINDDIR) directive, and then run the HCO BINDALL command using a post build event to bind all of the generated .bnd files.

HCO for DB2 LUW – UNIX Environment

One HCO for DB2 LUW demonstration application, hcodemo, is supplied. This application consists of several scripts and COBOL programs that demonstrate the functionality of the Host Compatibility Option.

The source files for this demonstration are located in $COBDIR/demo/hco The hcodemo.txt file in the same location explains how to use the application.

DB2 ECM – Windows Environment

All DB2 ECM samples are listed on the Show managed only list in the Visual COBOL Samples Browser.

The source files are located in subdirectories under %PUBLIC%\Documents\Micro Focus\Enterprise Developer\Samples\Eclipse\COBOL\sql\db2ecm.

Each sample application comes with a Readme file to explain how to use the application.

The following applications are provided:

DB2 ECM - Connect
Shows the syntax variants for connecting to and disconnecting from a DB2 database using Type 1 CONNECTs that IBM DB2 LUW supports.
DB2 ECM - Db2storedproc
Shows how to create and call a COBOL stored procedure using IBM DB2 LUW.
DB2 ECM - Dynamic
A simple example of using dynamic SQL with IBM DB2 LUW, performing a variety of SQL operations. If this program was written as a STATIC SQL program, it would have to be broken apart into two programs, since static SQL requires that the table exists beforehand or it would cause a Compiler error.
DB2 ECM - LOB Data Types
Illustrates the use of LOB LOCATOR and VALUES functions to retrieve LOB data from DB2 LUW.
DB2 ECM - Select
A simple example of using both singleton SELECT and cursor-based FETCH statements with IBM DB2 LUW.
DB2 ECM - Whenever
Shows how to use EXEC SQL WHENEVER statements for error handling, and the DB2(MSGAREA) Compiler directive to specify a COBOL variable for retrieving error message text larger than the 70 bytes provided in SQLERRMC.

DB2 ECM – UNIX Environment

A number of DB2 ECM sample programs are supplied. The source files for these samples are located in $COBDIR/demo/db2.

Each sample program comes with a progName.txt file to explain how to use the program.

db2test1.cbl
Shows the syntax variants for connecting to and disconnecting from a DB2 database using Type 1 CONNECTs that IBM DB2 LUW supports.
db2test2.cbl
A simple example of using both singleton SELECT and cursor-based FETCH statements with IBM DB2 LUW.
dynamic.cbl
A simple example of using dynamic SQL with IBM DB2 LUW, performing a variety of SQL operations. If this program was written as a STATIC SQL program, it would have to be broken apart into two programs, since static SQL requires that the table exists beforehand or it would cause a Compiler error.
lobdemo.cbl
Shows how LOB LOCATOR and VALUES functions to retrieve LOB data from DB2 LUW.
whenever.cbl
Shows how to use EXEC SQL WHENEVER statements for error handling, and the DB2(MSGAREA) Compiler directive to specify a COBOL variable for retrieving error message text larger than the 70 bytes provided in SQLERRMC.