Demonstrations of .NET COBOL

We provide a number of demonstration programs designed to help you to better understand some of the concepts involved when working with COBOL projects in Visual Studio.

The demonstration programs are installed in subfolders under %PUBLIC%\Documents\Micro Focus\Visual COBOL\Samples by default.

You can access the demonstrations with the help of the Visual COBOL Samples Browser for distributed application samples. See To start the Samples Browser for access instructions.

To view the demonstrations for .NET code, select Show .NET COBOL only from the list in the upper left corner of Samples Browser.

The following demonstrations are supplied:

Azure
Includes demonstrations of how to create COBOL Azure services.
Book Demo
Various demonstrations based on the Book demo application.
Classic
DB2 ECM - Connect
Shows the syntax variants supported by IBM DB2 LUW for connecting to and disconnecting from a DB2 database using Type 1 CONNECTs.
DB2 ECM - Db2storedproc
Shows the syntax variants for connecting to and disconnecting from a DB2 database using Type 1 CONNECTs that IBM DB2 LUW supports.
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 require the table to already exist or a compile error will result.
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
Illustrates the use of EXEC SQL WHENEVER statements for error handling, and using the DB2(MSGAREA) compiler directive to specify a COBOL variable for retrieving error message text larger than the 70 bytes provided in SQLERRMC.
Data Tools
ACU to MF Data Conversion
The solution builds the ACU2MFDataMigration.exe - a utility that converts an ACU Vision indexed file or directory of files to Micro Focus indexed files. You can use executable as delivered, or modify and rebuild the source code as desired.
RM to MF Data Conversion
The solution builds to RMMFDataMigration.exe and RM2MFconvert.dll which enable you to convert an RM/COBOL indexed file or directory of files to Micro Focus indexed files. You can use the executables as delivered, or modify and rebuild the source code as desired.
Diagnostic Tools
Azure Consolidated Tracing Facility
Includes a Visual Studio solution for an Azure service which consists of a Worker Role that calls a COBOL program on startup and writes a number of trace records using the COBOL tracing APIs.
Games
COBOL Blitz
Demonstrates the use of Windows forms, enumeration types, inheritance, and of sounds and graphics.
COBOLDoKu
Demonstrates Windows Forms using a .NET user control.
COBOL Tic-Tac-Toe
Demonstrates how to use WPF from aVisual COBOL application.
Language Reference for .NET COBOL
Core.Net
Core.NET introduces some of the standard features of the .NET Framework you need to be aware of, and any new COBOL syntax in order to support these features.
All other samples for COBOL for .NET
Each of the demonstrations shows how to use the corresponding COBOL feature within the .NET framework.
MFUnit Features / Unit Testing
A set of examples which demonstrate he capabilities of the Micro Focus Unit Testing Framework.
Moving to .NET
C# WinBook
Demonstrates how C# can interoperate with .NET COBOL. The SmartLinkage functionality enables you to expose COBOL group items as .NET types so that other managed languages can interoperate with them.
Interfacing With Std COBOL
Demonstrates how to use compatible types to interface with standard COBOL, and in particular how to manipulate group items and occurs structures.
Run Units
Multiple Run Units
Demonstrates why and how procedural COBOL is compiled and invoked in a multiple user environment. The application is an ASP.NET Web Service and you invoke it through the ASP.NET Development Server.
WCF Airport Demo with Run Units
Demonstrates the use of COBOL WCF Web services in multiple users environment. The sample consists of a COBOL WCF REST service and an application that consumes that service. The COBOLAirport application uses file operations to read the information from a COBOL Run Unit. In a real-world scenario, multiple users access the application simultaneously through various browser sessions.
SQL
OESQL (.NET OESQL) - Getting Started (.NET)
Demonstrates how to use static SQL with OpenESQL under ADO.NET, performing a variety of SQL operations. It also demonstrates the use of different styles of CONNECT statement.
OESQL - Connected Demo (.NET)
Fills a DataSet from a data source, modifies the DataSet and then synchronizes the changes in the DataSet with the data source. The modified contents of the DataSet are displayed in the Output Window. To execute this demonstration, you must first download and install the SQL Server Northwind database from the Microsoft Web site, http://www.microsoft.com. Once there, enter the following search criteria to locate the appropriate download page: northwind pubs database download
OESQL - Cursor Demo (.NET)
Demonstrates how to mix OpenESQL with direct calls to ADO.NET.
OESQL - Disconnected Demo (.NET)
Manipulates offline data in a DataSet. The results of the data manipulation are displayed in the Output Window.
OESQL - LOB Demo (.NET)
Demonstrates how ADO.NET can be used in mixed language projects to insert and select large objects (LOBs). LobDemo shows OpenESQL working with LOB columns in a SQL Server table.
OESQL - OrderStatus Demo (.NET)
Demonstrates how ADO.NET can be used in mixed language projects, and uses COBOL and C#.
OESQL - Web Application Book (.NET)
Includes a COBOL Web Application Project which contains a Web form. The form calls an intermediary program, SqlBookWrapper.cbl, which maps .NET data types onto COBOL data types. The intermediary program then calls the existing COBOL program, sqlbook.cbl, to perform the business logic.
OESQL - WPF Book (.NET)
Includes a Windows Presentation Foundation (WPF) interface written in .NET COBOL that interacts with an existing COBOL program. The form calls an intermediary program, SqlBookWrapper.cbl, which maps .NET data types onto COBOL data types. The intermediary program then calls the existing COBOL program, sqlbook.cbl, to perform the business logic.
SQLCLR
You need to run the following samples with administrator's rights:
SQLCLR - EmailAddress Type
Shows how to create a Microsoft SQL Server User Defined Type.
SQLCLR - HelloWorld
Shows how to create a simple Microsoft SQL Server stored procedure.
SQLCLR - RecordSet Procedure
Shows how to create a simple Microsoft SQL Server stored procedure that returns a row.
SQLCLR - RegEx User Functions
Shows how to create a simple Microsoft SQL Server stored function and how it can be used to perform field validation.
SQLCLR - TableValue Functions
Shows how to create a Microsoft SQL Server table value function and how it can be used to return multiple rows.
WCF
Various samples demonstrating how to develop COBOL applications using the Windows Communication Foundation.
Web
Various samples demonstrating how to develop COBOL applications for the Web.
Windows Forms
Various samples demonstrating how to develop COBOL applications that use Windows Forms.
WPF
Various samples demonstrating how to develop COBOL applications that use the Windows Presentation Foundation.
Web Applications
MultiRunUnits
Demonstrates why and how procedural COBOL is compiled and invoked in a multiple user environment. The application is an ASP.NET Web Service and you invoke it through the ASP.NET Development Server.
Web Application Book
A Web Application project which contains a Web form. The form provides a .NET interface to an existing COBOL program. The BookClass project provides a proxy COBOL program that calls the existing COBOL Book program.