473,383 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Calling C# DLL function from COBOL

I am getting trouble in calling a function defined in C# DLL from COBOL program.

First I want to ask whether it is possible to call a C# DLL function from a COBOL?

If anybody has done this then please help me.

Thanks in advance.

--
Rahul Anand
Nov 16 '05 #1
4 1135
On 7 Apr 2004 01:09:56 -0700, ra************@rediffmail.com (Rahul
Anand) wrote:
I am getting trouble in calling a function defined in C# DLL from COBOL program.

First I want to ask whether it is possible to call a C# DLL function from a COBOL?

If anybody has done this then please help me.

Thanks in advance.


I think the only way to cross the unmanaged->managed border is with a
COM Callable Wrapper and some sort of COM interface in your COBOL
system. I know of only two ways to call managed code (C#), this way
and from other managed code.
Nov 16 '05 #2
Brady Kelly <bk****@icom-it.co.za> wrote in message news:<ap********************************@4ax.com>. ..
I think the only way to cross the unmanaged->managed border is with a
COM Callable Wrapper and some sort of COM interface in your COBOL
system. I know of only two ways to call managed code (C#), this way
and from other managed code.

Thanks for the help. Will you provide me more details about calling a
DLL from COBOL code?

I have converted my DLL with TLBEXP tool to a COM callable wrapper.
Do I need to write COM Component wrapping the DLL function or the TLB
file can be directly called from COBOL? As I do not have any prior
COBOL programming experience, I am not sure whether it is still
feasible to do so or not?

Thanks,
Rahul Anand
Nov 16 '05 #3
Brady Kelly <bk****@icom-it.co.za> wrote in message news:<ap********************************@4ax.com>. ..
I think the only way to cross the unmanaged->managed border is with a
COM Callable Wrapper and some sort of COM interface in your COBOL
system. I know of only two ways to call managed code (C#), this way
and from other managed code.

Thanks for the help. Will you provide me more details about calling a
DLL from COBOL code?

I have converted my DLL with TLBEXP tool to a COM callable wrapper.
Do I need to write COM Component wrapping the DLL function or the TLB
file can be directly called from COBOL? As I do not have any prior
COBOL programming experience, I am not sure whether it is still
feasible to do so or not?

Thanks,
Rahul Anand
Nov 16 '05 #4
Hi Rahul

How you call a COM Module from COBOL will vary depending on what product your using

If your using MicroFocus COBOL (Net Express) then you can call a COM module by using a class control section and the invoke verb

eg

Class-Control
MyCOMClass is class "$OLE$MyCOMClass"
....
01 theCSharp object reference
....

invoke myCOMCLass "new" returning theCShar
invoke theCSharp "myMethodName" using avariabl
invoke theCSharp "finalize" returning theCSharp *> We no longer need it

Note the use if $OLE$ to denote it is a COM module

If you can move to Net Express with .Net (COBOL.Net) then you don't need any wrappers. You can just the C# Class directly

Hope this help
David

Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Rahul Anand | last post by:
I am getting trouble in calling a function defined in C# DLL from COBOL program. First I want to ask whether it is possible to call a C# DLL function from a COBOL? If anybody has done this then...
4
by: Rahul Anand | last post by:
I am getting trouble in calling a function defined in C# DLL from COBOL program. First I want to ask whether it is possible to call a C# DLL function from a COBOL? If anybody has done this then...
3
by: singlal | last post by:
Hi, Has anyone called a COBOL subroutine using COBOL CALL from a COBOL/DB2 stored procedure? What are the complexities associated and what system setting might be required? Is this approach...
2
by: singlal | last post by:
Hi, my question was not getting any attention because it moved to 2nd page; so posting it again. Sorry for any inconvenience but I need to get it resolved fast. Need your help! ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.