Micro Focus Community
  • Site
  • User
  • Site
  • Search
  • User
  • Home
  • COBOL Development / Mainframe
  • Software Delivery & Testing
  • Over the Back Fence
  • More ...

NOTICE: Our Community is moving.  Get more information. Updated information on a New Login Process

Visual COBOL
  • COBOL Development / Mainframe
  • COBOL
  • Visual COBOL
  • More
  • Cancel
Visual COBOL
Visual COBOL - Wiki C#/Java COBOL interop made…
  • Forum
  • Blogs
  • Files
  • Wikis
  • Members
  • Mentions
  • Tags
  • More
  • Cancel
  • New
This group requires membership for participation - click to join
  • Visual COBOL - Wiki
  • Accessing RM Data files from Managed Visual COBOL
  • Adding Print Preview/Screen Print Functionality to a Windows Form
  • Adding controls to a .NET WPF application
  • Announcing Data Tools AddPack for Visual COBOL
  • C#/Java COBOL interop made easy with SmartLinkage
  • C#/Java COBOL interop made easy with SmartLinkage - please give us your feedback
  • COBOL Data Groups
  • COBOL on Azure
  • Calling Visual COBOL .NET classes from Net Express native programs
  • Coming Soon... Local Variables in Managed COBOL
  • Commenting out code in multiple source files using Visual Studio
  • Creating JSP web applications using Visual COBOL for Eclipse
  • Creating web applications using Visual COBOL and ASP.NET
  • Differences between DEBUG and RELEASE builds in managed code?
  • Displaying a different Tooltip image for each dataGridView row
  • Environment Variables in VisualCOBOL
  • Generate code documentation when building Visual COBOL Applications
  • Getting Started with Visual COBOL for Eclipse
  • Getting Started with Visual COBOL for Visual Studio
  • How to handle multiple forms in a Windows Forms Application
  • How to set and retrieve a session variable for a current Web Form in ASP.NET - A simple example
  • JVM COBOL - Getting Started
  • Managed COBOL - An Overview
  • Managed COBOL – JVM COBOL & .NET COBOL Syntax
  • String Handling in Managed COBOL
  • Testing the Visual Studio and Eclipse IDE
  • Using Labels with Visual COBOL
  • Using Owner Drawn Tooltips in a Windows Form in Visual COBOL 2010
  • VISUAL COBOL, .NET and Microsoft Office combined is a great opportunity for a little CRM
  • +Visual COBOL - JVM Web Services Portal
  • Visual COBOL ASP.NET Shopping Cart Demonstration
  • Visual COBOL R4 Installer Technology
  • Visual COBOL and .NET Arrays
  • Visual COBOL and COBOL for .NET Language Introduction
  • Watchpoints in Visual Studio
  • Web Site or Web Application ?
  • Working with Buttons in Visual COBOL
  • Working with CheckBoxes in Micro Focus Visual COBOL
  • Working with Textboxes in Visual COBOL
  • Working with the DataTimePicker in Visual COBOL

C#/Java COBOL interop made easy with SmartLinkage

SmartLinkage – what does it do?


Prior to R4, if you wanted to call a COBOL program from another language, you had to create wrapper functions to convert the COBOL data items to managed types. SmartLinkage does that for you, so you can access COBOL linkage data from other managed languages transparently.

– No hand-written wrapper classes needed

– No changes required to the original code

– COBOL data shown in C#/Java/COBOL intellisense 

Easy configuration steps

• Project1 (COBOL)

– Create a managed project and add COBOL code

– Compile with the ilsmartlinkage directive

• Project2 (eg C#)

– Create a C# project in the same solution

– Add a project reference to Project1

– Add a reference to MicroFocus.COBOL.Runtime (unless Project2 is COBOL)

– Now you can access Project1’s linkage data directly 

Customisation


• Default

– hyphens are removed from COBOL data names and the following letter upper-cased

   eg lnk-details is accessed from C# as lnkDetails 

• ilcutprefix(x) directive

– Allows you to configure data item names

– Strips the text x from the front of the COBOL name

  eg ilcutprefix(lnk)
  lnk-details is accessed from C# as Details 

Example


Each 01 group linkage item is exposed as a class with subordinate fields exposed as properties.
For example, in the following COBOL program, compiled with the ilsmartlinkage directive, a class is created for the lnk1 linkage item that contains 2 properties, a string and an int. 

  program-id program1 as "program1".
  linkage section.
  01 lnk1.
     03 sub-lnk1 pic x(20).
     03 sub-lnk2 pic 9(5).
  procedure division using by reference lnk1.

My calling C# program:

  program1 myProg = new program1();
  lnk1 myLinkage = new lnk1();
  myLinkage.subLnk1 = “myString”;
  myLinkage.subLnk2 = 1234;
  myProg.program1(myLinkage);

Type Mapping

Compiling a COBOL program with ilsmartlinkage directive exposes the COBOL data items as the following types on .NET & JVM.


COBOL                    C# types         Java types
PIC X(n)                 string           String
PIC S9(n) n <= 2         sbyte            byte
PIC 9(n) n <= 2          byte             byte
PIC S9(n)2 < n <= 4      short            short
PIC 9(n) 2 < n <= 4      ushort           short
PIC S9(n) 4 < n <= 9     int              int
PIC 9(n) 4 < n <= 9      uint             int
PIC S9(n) 9 < n <= 19    long             long
PIC 9(n) 9 < n <= 19     ulong            long
PIC 9(n)V9(m)            decimal          ScaledInteger
PIC S9(n)V9(m)           decimal          ScaledInteger
COMP-1                   float            float
COMP-2                   double           double
PIC Z9 (any numeric edited) string        String
PIC A(n)                 string           String
Group item               string           String

For more information :


• Free download of Visual COBOL R4

• See the “C# WinBook” sample in Visual COBOL for Visual Studio R4
This shows a C# WinForm using SmartLinkage to access COBOL legacy program data directly. 

• You can see a demo of this technology in a recent webinar - “Visual COBOL for Visual Studio R4 – Migrating from Net Express”.
The demo takes a Net Express application, moves it to Visual COBOL for Visual Studio. Then modernizes the front–end with a COBOL WinForm using SmartLinkage.

  • Migration
  • COBOL
  • Eclipse
  • Language
  • Visual Studio
  • JVM
  • .NET
  • VisualCOBOL
  • Development
  • Share
  • History
  • More
  • Cancel
  • Comment
Related
Recommended
  • Terms Of Use
  • Privacy Statement
  • Download Policy
  • Cookie Policy
  • Support & Services
  • www.microfocus.com
  • Contact Us

 

  • © 2001 - 2018 Micro Focus. All rights reserved.