Highlighted
Absent Member.
Absent Member.
4442 views

How to call COBOL from C# interface

Hi,

Please let me know how to call COBOL program(API created in COBOL) in my C# interface with out changing original code.

Thanks,

Manasa 

0 Likes
5 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: How to call COBOL from C# interface

Hi Manasa,

If you are referring to calling a procedural COBOL program that uses a linkage section to pass parameters directly from C# then you should look into using the ilsmartlinkage directive.

An example can be found in the docs here:

There is also an example under the Samples Browser, select COBOL Book in the left hand pane and then C# WinBook in the right hand pane.

Thanks.

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: How to call COBOL from C# interface

Hello Sir,

Thank you very much for the reply.

In my scenario I have to do below jobs.

1. Call Cobol program(Call Linkage  section parameter) from COBOL API)

2. Enable that API in my C# interface.

Please guide me on below questions.

1. Is calling linkage section parameter enables API or I need to add separate functionality to enable cobol API.

2. Enabling API in C# from passing parameters is different then please guide me how to enable API (API created in COBOL) in C#.

We are using Raincode legacy program to convert from Mainframe to .NET.

Am very much new to this COBOL and I have basic knowledge of C#. Please guide me.

Thanks,

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: How to call COBOL from C# interface

Hi,

I referred the Docs link which provided. Below statement is there in summary page:

•In the non-COBOL project, add a reference to the COBOL project and the MicroFocus.Runtime.Assembly

As per above statement I need to add "MicroFocus.Runtime.Assembly" in my C# interface reference. But what reference I need to add to COBOL project as I have not involved in COBOL programming.

Please guide me.

Thanks,

Manasa

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: How to call COBOL from C# interface

Hi,

I don't have access to sample browser as I have not installed software. If possible, please provide any sample example of calling cobol parameters in C# interface (linkage section).

Any example application with the code is great help to me.

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: How to call COBOL from C# interface

You must have access to the Visual COBOL software in order to create this properly as the COBOL programs must be compiled as managed code using the ilsmartlinkage directive.

How are the COBOL programs that you are attempting to call from C# delivered to you? Do you have access to the source code or are you just provided with an executable such as a .dll?

Is the COBOL piece compiled with Visual COBOL? Is it unmanaged code or managed .NET code?

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.