
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Call from WCF TO COOBOL
HI,
Scenario:
I have to call COBOL program from my WCF/WCF REST.
I have created a wcf and wcf rest project and incorporated my C# code in the interface implementation. However its failing to call COBOL and getting results.
The C# code to call cobol is working fine when call from console application. Same code is not able to call from WCF.
Kindly let me know how do I call COBOL (C# code exists and working in console) from WCF REST or WCF.
Am new to WCF and COBOL. Kindly give some inputs.
Thanks,
Manasa

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
If you are trying to call a procedural COBOL program from a C# program running as a WCF service then you should do this by creating a RunUnit in C# and then calling the COBOL program within the RunUnit.
Please see the documentation here
This will direct you to open up the file MicroFocus.COBOL.RuntimeServices.chm, which is installed in the Help folder of your installation. Within this help file are examples of how to call COBOL using the RunUnit class from C#.
.Example:
Create a run unit for the called COBOL program MicroFocus.COBOL.RuntimeServices.RunUnit myRunUnit = new MicroFocus.COBOL.RuntimeServices.RunUnit(); try { // Call the COBOL program result = myRunUnit.Call("Program1", "Alice", 21); result2 = myRunUnit.Call("Program2"); } finally { // Destroy the run unit myRunUnit.StopRun(); }