Tutorials: SQL CLR Stored Procedures Called via COBOL and JCL

Includes tutorials that demonstrate how to invoke a native COBOL program via JCL, how to call SQL CLR stored procedures from COBOL programs, and how to call COBOL programs from SQL CLR stored procedures.


These tutorials are written from the perspective that all of the following is true. Specific instructions for setting up your environment to adhere to these assumptions is found in the Before you begin a tutorial section that follows:

  • Windows File Explorer is set to show file names and extensions.
  • You are running the latest version of Micro Focus Enterprise Developer, which has been installed on your local machine using default installation settings.
  • You have installed and can access a supported version of Microsoft SQL Server.
  • Enterprise Developer is started on your local machine.
  • Your parent project directory is c:\tutorials\SQLCLR. If you choose to use an alternative parent project directory, adjust the instructions accordingly.
  • You have addressed all of the items in the Before you begin a tutorial section below.

Before you begin a tutorial

Install Microsoft SQL Server
To complete any of the HCOSS tutorials, you must have Microsoft SQL Server, including the SQL Server Management Studio, installed and configured on your machine. For information on current supported versions, see the Database Access - OpenESQL section of the Additional Software Requirements on Windows topic.
Set Windows File Explorer options
These tutorials assume that your Windows File Explorer options are set to use the Details layout, and to show file name extensions. See your Windows documentation for more information.
Create a parent project directory
Create a directory in which to store the project files imported or created while completing this tutorial, which cites a parent project directory of c:\tutorials\SQLCLR.
Start Visual Studio
If you need instructions to get Visual Studio started on your local machine, see To start Visual Studio.

Demonstration solutions

These use a demonstration application that includes JCL, native COBOL, procedural COBOL, and SQL CLR stored procedure code. First, a native COBOL program is invoked via JCL. The invoked program calls a SQL Server SQL CLR stored procedure. The called stored procedure calls a second, procedural, COBOL program that then calls a second stored procedure that, unlike the first stored procedure, is nested. This nested stored procedure then calls other COBOL programs. Finally, a count of called programs and stored procedures is returned back to the calling native COBOL program. The count is increased by 1 for every program called and by 10 for every stored procedure called.

All demonstration solutions used in these tutorials contain projects that use the same names and provide essentially the same functionality; however, each has been modified to illustrate the type of call demonstrated in its corresponding tutorial.

Information on specific demonstration applications can be found in the introductory topic for each tutorial.


You must work through Tutorial: Prepare the SQL CLR Stored Procedures Environment before proceeding to another SQL CLR stored procedures tutorial. However, the four SQL CLR stored procedures tutorials are not interdependent and may be done in any order: