Demonstration Programs for COBOL on Microsoft Azure

The demonstration programs for COBOL on Microsoft Azure are available from within the Visual COBOL samples and are installed by default in %PUBLIC%\Documents\Micro Focus\Enterprise Developer\Samples\Azure:

The following demonstrations are available:

AzureBookDemo
This demonstration is a Visual Studio solution containing a Microsoft Azure service consisting of a web role and a worker role that interact with an existing COBOL program. The web role consists of a COBOL program (BookWrapper.cbl) providing the user interface for the service. The worker role demonstrates how you can communicate with the web role by using Microsoft Azure queue storage and how you can call an existing COBOL program (book.cbl) to perform the business logic.

WorkerRole.cbl - contains the code to start and run the worker role. It reads the role configuration and uses queues for communicating with the web role. It contains the following methods:

  • Run - Run the role. Create the message queues, mount the virtual hard drive and process the messages on the queues.
  • OnStart - Initialization. Start the DiagnosticMonitor and set up delegate to handle Role changes.
  • ConfigurationSettingPublisher - Delegate to set up the RoleChangeHandler. On each invocation this adds a RoleChangeHandler which has been moved into a separate class (RoleChangeHandler) in order to allow arguments to be passed when it is created.
  • CreateMessageQueues - Set up the Microsoft Azure queue storage. Create the message queues used to pass the book information between the web and worker roles.
  • SetupFileAccess - Set a dd_ mapping to the location of the data file included with the role.
  • HandleMessage - Handle an incoming request queue, call the legacy code with the supplied book-details, and post the response.
  • OnStop - Called when the role stops. Unmount the drive to ensure it gets released.

Global.asax.cbl - contains the following methods:

  • Application_Start - Set up delegate to handle role changes.
  • ConfigurationSettingPublisher - Delegate to set up the RoleChangeHandler. On each invocation this adds a RoleChangeHandler which has been moved into a separate class (RoleChangeHandler) in order to allow arguments to be passed when it is created.
AzureSQL
This demonstration shows how to use ESQL running on Azure. It shows how you can work locally on SQL Server 2008 R2 and how you can switch to an Azure SQL Database with minimal change.
AzureStorage
This demonstration is a Visual Studio solution containing a Microsoft Azure service consisting of a web role that interacts with an existing COBOL program. The web role consists of C# and COBOL program (CustomerInfoDataContext.cbl) providing the C# ASP. NET with all the information to create, edit, update and delete customer information storage in the Microsoft Azure Table Storage.
AzureTracing
This demonstration includes a Visual Studio solution for a Microsoft 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.
SqlAzureBookDemo
This demonstration is a Visual Studio solution for a Microsoft Azure service that consists of a web role and a worker role interacting with an existing COBOL program. The web role consists of a C# and COBOL program (SqlBookWrapper.cbl) which provides the user interface for the service. The worker role demonstrates how to use a Microsoft Azure queue storage to communicate with a web role and call an existing COBOL program (sqlbook.cbl) to perform the business logic.
Thumbnails
This demonstration is a COBOL version of the Microsoft Thumbnails sample that ships with the Microsoft Microsoft Azure SDK. It is a service that demonstrates a web role and a worker role. The web role provides a user interface for uploading photos and adds a work item to a queue. The worker role fetches the work item and creates thumbnails in the designated directory.

The demonstrations are documented fully in their readme files, which are also in the above location. The readmes explain how to run the demonstration, together with a description of each file and its references to Microsoft.Windows.Azure.