Posts tagged: COBOL

Reflection and COBOL

By spgennard, February 13, 2010 11:56 pm

For the last couple of months I have working on Visual Studio 2010 and this include Microsoft CLR v4 and I was recently asked how to write a test that determines at runtime which CLR is being used and what assemblies it uses. I replies would use reflection. So I dropped my friend a mega simple demo… and here it is.

       $set ilusing"System.Reflection"

        01 myAssembly type "Assembly".
        01 usedAssemblyName type "AssemblyName".

        set myAssembly to type "Assembly"::"GetExecutingAssembly"

        display "My exe is " myAssembly::"FullName"
        display "and is using CLR " myAssembly::"ImageRuntimeVersion"
        display "and is loaded from " myAssembly::"Location"
        display "the initial method of this program was "
          myAssembly::"EntryPoint"::"Name"

        display "This assembly references -> "
        perform varying usedAssemblyName
             through myAssembly::"GetReferencedAssemblies"
              display "-> " usedAssemblyName
        end-perform

And the output of the program is:

My exe is clrver, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
and is using CLR v2.0.50727
and is loaded from d:\clrver.exe
the initial method of this program was _MF_ENTRYThis assembly references ->
-> mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-> MicroFocus.COBOL.Runtime, Version=3.6.0.0, Culture=neutral,
PublicKeyToken=0412c5e0b2aaa8f0

Scripting Languages and COBOL

By spgennard, January 19, 2010 11:39 am

The use of scripting languages with other languages has increased over the last couple of years, from a simple case of interoperability, reuse of scripting code to allowing your code to customised via the user of external scripts. All of which are real world examples I have seen customers use.

Interoperability between languages is very important to COBOL environments just as much as other languages. Some platforms such as Microsoft’s .Net with their CLR makes life much easier by allowing all languages to share a common infrastructure ie: the instruction set and the VM (MSIL and CLR) along with a base class library to get you started.

Environments such as Sun’s VM (JVM) provide two different approaches to interoperability with Java, the first is via JNI/JNA and the second is producing bytecode that runs as is on the VM.

Although the Micro Focus COBOL compiler does not support JVM bytecode or Java source generation it does have support for invoking classes/methods via the OO invoke verb.

12 Tips for using Micro Focus COBOL

By spgennard, December 22, 2009 11:36 pm

12 Tips for using Micro Focus COBOL

As it is close to Christmas and I wanted to do something with 12 in the title, I’ve thrown together some useful if not un-ordered list of 12 things tips using Micro Focus COBOL.

Remember I am just a developer and just want to help fellow developers out :-) so…

Merry Christmas!

and here is my list…

  1. Use DLLs/Shared objects rather than .int code
  2. DLLs/Shared objects can be preloaded using:
    01 my-ptr procedure-pointer.
    set my-ptr to entry "sodllname"

    Note; sodllname does not have the extension… let the runtime choose it for you!

  3. Use a good development environment such as Visual Studio or on Unix use Eclipse offering if you have a workstation, otherwise I personally use vim/gvim if terminal access is the only choce.
  4. Remember you have a great choice of platforms from Windows to Linux to a load Unix platforms, so choice is king. (did I say that…)
  5. Try using managed code (.Net) if you want to create WPF/WinForms or use WCF
  6. Interopability is great, so if you see a Java Class, .Net Class, COM object, ‘C’ function or a Web Service… use it! You can even mix unmanaged and managed applications..

A Comparison Of .Net COBOL, Visual Basic and C#

By spgennard, December 15, 2009 1:35 pm

Today my collegues Robert and Alex have finally :-) decided to publish a document that compares Visual Basic, C# and COBOL for .Net under The Creative Commons Attribution-ShareAlike 2.5 License.

Rather than doing a cut-paste job, here is a quote from alex, along with a link to the “real” article itself.

Enjoy.

Alex Turner said:

A Comparison Of .Net COBOL, Visual Basic and C#

Introduction

If you are a COBOL programmer wanting to learn C# or a VB programmer wanting to learn COBOL as a .net language (or any other combination of VB.net, C# and COBOL) then this is a good place to start.

Background

If you are a COBOL programmer wanting to learn C# or a VB programmer wanting to learn COBOL as a .net language (or any other combination of VB.net, C# and COBOL) then this is a good place to start.

It has often been noted that the richness of the COBOL language in its Micro Focus .net implementation is not well known. Robert Sales and I have worked on this document to help bring the language to peoples’ attention and to help people who need to work with COBOL on the .net platform.

Free compiler for non-commercial use.

By spgennard, December 8, 2009 9:38 am

If you are interested in trying out some of my examples with a modern COBOL compiler.. let me give you a quote from a friend.

From: Twitter “Scot Nielsen said: Micro Focus COBOL for .NET and Visual Studio available here FREE for non-commercial.

The development environment/compiler can be downloaded from the Micro Focus Shop.

More information can be picked up from the Microsoft Visual Studio Gallery

Panorama Theme by Themocracy - tweaked by SpG

AWSOM Powered