Hi,
In a nutshell, how can I call managed COBOL from C#. Is there any references I need to add or something ??
Best Regards
#VisualCOBOL
#COBOL
Hi,
In a nutshell, how can I call managed COBOL from C#. Is there any references I need to add or something ??
Best Regards
Hi,
In a nutshell, how can I call managed COBOL from C#. Is there any references I need to add or something ??
Best Regards
If you are calling a method in a COBOL class from C# then all you need to add is a reference to the COBOL project for the Class library to the C# project.
If you are trying to call a COBOL procedural program from C# then you need to add a reference to the MicroFocus.COBOL.Runtime assembly to the C# project.
Open up the Samples browser in Start-->All Programs-->Micro Focus Visual COBOL-->Samples and look at the program called C# Winbook as this is a good example of how to call a managed COBOL procedural program directly from C# which also uses the ilsmartlinkage directive to expose the COBOL linkage section to C#.
Thanks..
Hi,
In a nutshell, how can I call managed COBOL from C#. Is there any references I need to add or something ??
Best Regards
It worked well for me but I have noticed that any hyphened variables or method names are not portable to C# i.e they are not accessible from the auto-complete or manually! Generally it's awesome :)
Thanks
Hi,
In a nutshell, how can I call managed COBOL from C#. Is there any references I need to add or something ??
Best Regards
It worked well for me but I have noticed that any hyphened variables or method names are not portable to C# i.e they are not accessible from the auto-complete or manually! Generally it's awesome :)
Thanks
Hi,
In a nutshell, how can I call managed COBOL from C#. Is there any references I need to add or something ??
Best Regards
A hyphen is not a supported character in C# so you cannot have data-names with hyphens.
You can use the ilsmartlinkage directive if this is a procedural COBOL program and it will remove the hyphens from linkage section data items.
From docs:
"Hyphens are removed from data item names and the letter following a removed hyphen is folded to upper case. For example a data item author-name is renamed to AuthorName".
Hi,
In a nutshell, how can I call managed COBOL from C#. Is there any references I need to add or something ??
Best Regards
Hi Chris,
ILSMARTLINKAGE does remove hyphen from the Linkage variables. Also it creates the Class for the program (as Program Class), with all the methods/entry points as Methods of the class. It converts all 01 level Linkage data items as Classes too.
For example : After using the ILSMARTLINKAGE Compiler directive.
1. A new class is created as Program(Same as program name).
2. Convert all procedures to methods in the class fro each entry point( for ex Addition ) is a method now in the Program class.
2. It remove hyphen from the linkage variables and convert it in Upper case. (add-number1 as AddNumber1)
3. It also create 01 level Linkage items as Class Addnumber1 is a class now , we need to create an object of the Addnumber1 class and assign values to it. then use it in invoking the method. (So all the 01 Level Linkgae variables are converted to class variables)
But if in a linkage section there is one variable (at 01 level) which is defined using redefine clause than it won't be converted into the class as mentioned in step 3.
For ex. 01 Sum Pic xx redefine add-number1.
Then Sum wont be converted as a class variable, So to use it we have to use AddNumber1 class variable as part of Program class.
So how we can solve this problem.
Hope you are able to understand the problem here.
Thanks
Charan
Hi,
In a nutshell, how can I call managed COBOL from C#. Is there any references I need to add or something ??
Best Regards
Hi Chris,
ILSMARTLINKAGE does remove hyphen from the Linkage variables. Also it creates the Class for the program (as Program Class), with all the methods/entry points as Methods of the class. It converts all 01 level Linkage data items as Classes too.
For example : After using the ILSMARTLINKAGE Compiler directive.
1. A new class is created as Program(Same as program name).
2. Convert all procedures to methods in the class fro each entry point( for ex Addition ) is a method now in the Program class.
2. It remove hyphen from the linkage variables and convert it in Upper case. (add-number1 as AddNumber1)
3. It also create 01 level Linkage items as Class Addnumber1 is a class now , we need to create an object of the Addnumber1 class and assign values to it. then use it in invoking the method. (So all the 01 Level Linkgae variables are converted to class variables)
But if in a linkage section there is one variable (at 01 level) which is defined using redefine clause than it won't be converted into the class as mentioned in step 3.
For ex. 01 Sum Pic xx redefine add-number1.
Then Sum wont be converted as a class variable, So to use it we have to use AddNumber1 class variable as part of Program class.
So how we can solve this problem.
Hope you are able to understand the problem here.
Thanks
Charan
Hi,
In a nutshell, how can I call managed COBOL from C#. Is there any references I need to add or something ??
Best Regards
Hi Chris,
ILSMARTLINKAGE does remove hyphen from the Linkage variables. Also it creates the Class for the program (as Program Class), with all the methods/entry points as Methods of the class. It converts all 01 level Linkage data items as Classes too.
For example : After using the ILSMARTLINKAGE Compiler directive.
1. A new class is created as Program(Same as program name).
2. Convert all procedures to methods in the class fro each entry point( for ex Addition ) is a method now in the Program class.
2. It remove hyphen from the linkage variables and convert it in Upper case. (add-number1 as AddNumber1)
3. It also create 01 level Linkage items as Class Addnumber1 is a class now , we need to create an object of the Addnumber1 class and assign values to it. then use it in invoking the method. (So all the 01 Level Linkgae variables are converted to class variables)
But if in a linkage section there is one variable (at 01 level) which is defined using redefine clause than it won't be converted into the class as mentioned in step 3.
For ex. 01 Sum Pic xx redefine add-number1.
Then Sum wont be converted as a class variable, So to use it we have to use AddNumber1 class variable as part of Program class.
So how we can solve this problem.
Hope you are able to understand the problem here.
Thanks
Charan
Hi,
In a nutshell, how can I call managed COBOL from C#. Is there any references I need to add or something ??
Best Regards
Try adding the directive NOILSMARTRESTRICT to the class. The default is set to ILSMARTRESTRICT which suppresses the generation of redefined elementary items.
Thanks.
Hi,
In a nutshell, how can I call managed COBOL from C#. Is there any references I need to add or something ??
Best Regards
Actually, I just tested the NOILSMARTRESTRICT directive and it does not solve the problem as there appears to be a bug. I am creating an RPI for this and Development is currently researching the problem.
Thanks.
Hi,
In a nutshell, how can I call managed COBOL from C#. Is there any references I need to add or something ??
Best Regards
Hi,
In a nutshell, how can I call managed COBOL from C#. Is there any references I need to add or something ??
Best Regards
Hi,
In a nutshell, how can I call managed COBOL from C#. Is there any references I need to add or something ??
Best Regards
Hi,
In a nutshell, how can I call managed COBOL from C#. Is there any references I need to add or something ??
Best Regards
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.