Blue Theme Orange Theme Green Theme Red Theme
 
World Class ASP.NET Hosting – Click Here for 3 Months Free/NO Setup Fee!
Home | Forums | Videos | Photos | Downloads | Blogs | Interviews | Jobs | Beginners | Training
 | Consulting  
Submit an Article Submit a Blog 
 Login Close
User Id:
Password:
 
Forgot Password
Forgot Username
Why Register
 Jump to
Skip Navigation Links
TechnologyExpand Technology
WebsiteExpand Website
World Class ASP.NET Hosting – Click Here for 3 Months Free/NO Setup Fee!
 Resources  
Close
 Our Network  
Close
Search :       Advanced Search »
Home » COBOL.NET » Cobol for Microsoft .NET

Cobol for Microsoft .NET

This article gives you introduction about how the age old COBOL can take a new energetic look under Microsoft.NET.

Total page views :  24669
Total downloads :  136
   Print Read/Post comments Post a comment  Similar Articles  
   Email to a friend  Bookmark  Author's other articles  
Download Files:
COBOLCODEBYNRS.zip
 
Become a Sponsor

1. Summary

This article gives you introduction about how the age old COBOL can take a new energetic look under Microsoft.NET.

2. Introduction   

In the article titled IL "THE LANGUAGE OF CLR" - A PLATFORM FOR CROSS-LANGUAGE I already talked about the cross language capabilities of Microsoft.NET architecture. In this section I would like to draw your attention towards one of the popular languages COBOL and would like to present some examples to show how COBOL extends its capability to deliver wide range of applications under .NET.   

Fujitsu has taken up the task of writing COBOL compiler that targets Common Language Runtime Environment to exploit the best features of Common Language Infrastructure. Fujitsu Software is an active member that is participating in the standardization of many of the drafts relating to .NET. It had brought many solutions and products relating to COBOL in the past and is working very hard to bring many other products that target Microsoft.NET  

I happened to go through all the previews provided by Fujitsu Software and take this privilege to present my own examples and feeling about this new compiler.   Though its not the final version of the release, I would like to provide future prospects of thislanguage. 

3. Installation Instructions   

If you dont have the COBOL preview III software from Fujitsu then you can download the file PackageFujitsuCOBOLPreviewIII (954KB), a Windows Installer Package, from http://www.adtools.com or http://www.fujitsu.com

Software Requirements:  

  • Windows 2000 Server
  • Windows 2000 SP1 or higher
  • .NET SDK Beta 2 ( Doesnt work with Beta1)
  • PackageFujitsuCOBOLPreviewIII

Installation Procedure 

  • Run PackageFujitsuCOBOLPreviewIII Windows Installer and follow the instructions.
  • Create a virtual directory named COBOL and map this to Examples folder which can be found at the following location drivename\Program Files\Fujitsu COBOL .NET Preview III\Examples\Web
  • Create directory named COBSAMPLES under drivename\Program Files\Fujitsu COBOL .NET Preview III\Examples\Web  

Note

If you create a virtual directory than the specified above and map it to any other location you may not be able to run the COBOL.NET applications.

Installing the COBOL.NET software  

Double click the Windows Installer you will find the following screen. Follow the instructions and it setups the required things to support ASP.NET applications, Windows Applications and VS.NET.  

Mapping a Virtual Directory

Open the Internet Service Manger. If required expand the node on left-hand side pane to find Default Web Site. Right click on Default Web Site and choose new/virtual directory option. Give the alias name as COBOL and then you will find the screen with browse option. Now map this to Examples directory as show in the below diagram.  

4. ASP.NET Applications using COBOL  

Look at the following example. It is just like any other aspx page with language attribute set to COBOL. For those who are migrating from COBOL and writing .NET applications for the first time it might take some time to understand the technology. But for time being type in your code in by opening a notepad and save as cobol.aspx. The extension of ASP.NET applications is .aspx. Ensure to save this in COBSAMPLES directory.  Thats all. Type in the following URL: http://localhost/cobol/web/cobsamples/cobol.aspx

<%@ page language="COBOL" %> 
<script runat="server">
       OBJECT.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       77 I PIC S9(5) COMP-5.
       END OBJECT.  
</script>
<% PERFORM VARYING I FROM 1 BY 1 UNTIL I > 5 %> 
<% IF I=1 THEN %> 
<center><font size="<%=I%>">COBOL IN 1970'S</font>
<br></center> 
<% END-IF %>
<% IF I = 2 THEN %> 
<center><font size="<%=I%>">COBOL IN 1980'S</font>
<br></center>
<% END-IF %>  
<% IF I = 3 THEN %> 
<center><font size="<%=I%>">COBOL IN 1990'S</font>
<br></center> 
<% END-IF %>  
<% IF I = 4 THEN %> 
<center><font size="<%=I%>">COBOL IN 2000</font> <br></center>
<% END-IF %>   
<% IF I = 5 THEN %> 
<center><font size="<%=I%>">COBOL.NET IN 2001</font><br> </center> 
<% END-IF %>
<% END-PERFORM. %> 
 

The tag <script runat="server"> ensures the COBOL language understand the ASP.NET framework and makes it run at the server side. The remaining code is a combination of html mixed with simple asp code. This shows how simple and easy for COBOL programmers to migrate to ASP.NET. What all they need to understand is, what .NET is all about?.


  

The following is the output generated by the above code:
   

5. Creating Web Services Using COBOL

Many authors have written about Web Services. So I wont be saying all the details about Web Services here. In sample terms Web Services are distributed applications accessible across Internet using standard protocols such as SOAP and XML.The following is the COBOL Code for a Web Service called CalculateArea. This Web Service takes two inputs and returns the area of a rectangle. The extension for Web Services in ASP.NET is .asmx. The COBOL used is not procedural COBOL but Object COBOL. 

<%@ WebService Language="COBOL" Class="AreaOfRect" %>
       CLASS-ID. AreaOfRect. 
       OBJECT. 
       PROCEDURE DIVISION. 
       METHOD-ID. calculateArea. 
       DATA DIVISION. 
       LINKAGE SECTION. 
       01 SideA PIC S9(5) COMP-5. 
       01 SideB PIC S9(5) COMP-5. 
       01 RectangleArea PIC S9(5) COMP-5. 
      PROCEDURE DIVISION USING BY VALUE SideA SideB RETURNING RectangleArea.
       COMPUTE RectangleArea = SideA * SideB. 
       END METHOD calculateArea. 
       END OBJECT. 
       END CLASS AreaOfRect.
 

Key-in the above code in notepad and save it as CalculateArea.asmx and save it in COBSAMPLES directory. To view the result type in the following URL: http://localhost/cobol/web/cobsamples/calculatearea.asmx

The following is the output

Click on the CalculateArea link. You will get the following screen.

 

Enter the values of SideA and SideB and click invoke. It throws the result in XML format. Needless to mention about the usefulness of XML format, it can be consumed by any application.

Once upon a time writing distributed applications using COBOL was unthinkable dream. But now with Microsoft.NET, languages have become equal and any language could produce same results. Thats not what COBOL can do for you. It can be useful for writing Windows application and can be used for cross language development etc. In the forthcoming articles I will be dealing with many other aspects of .NET using COBOL. Hope by now you might have felt the power of COBOL under .NET.

6. Conclusion

Fujitsu is trying to get COBOL.NET as soon as possible to the market. They got very good reputation for delivering COBOL related products and solutions. Its actively participating in standardization efforts of CLI (ECMA). The other participants include Hewlett-Packard, Intel Corporation, IBM, ISE, Microsoft, Monash University, Sun Micros Systems etc. There is no doubt that COBOL could be used more effectively than ever, for delivering wide range of applications. All those people using COBOL can now think of designing distributed applications, writing server-side programming, writing windows applications and so on. Be tuned for further developments in this area, as this is one of the popular languages used across the globe even today. Wait for my up coming articles in the same section.

7. Articles by the same Author

IL "THE LANGUAGE OF CLR" - A PLATFORM FOR CROSS-LANGUAGE  

Microsfot.NET An insight into code reusability and COM Interoperability Part 1


Login to add your contents and source code to this article
 About the author
 
Narayana Surapaneni
Narayana Rao Surapaneni, a Software Engineer working for Patni Computer Systems Limited, India is a Microsoft Certified Solution Developer and Sun Certified Java Professional. He also holds other certifications in ASP, E – Commerce Concepts, Visual InterDev etc.
Looking for C# Consulting?
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional consulting company, our consultants are well-known experts in .NET and many of them are MVPs, authors, and trainers. We specialize in Microsoft .NET development and utilize Agile Development and Extreme Programming practices to provide fast pace quick turnaround results. Our software development model is a mix of Agile Development, traditional SDLC, and Waterfall models.
Click here to learn more about C# Consulting.
 
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
Go.NET
Build custom interactive diagrams, network, workflow editors, flowcharts, or software design tools. Includes many predefined kinds of nodes, links, and basic shapes. Supports layers, scrolling, zooming, selection, drag-and-drop, clipboard, in-place editing, tooltips, grids, printing, overview window, palette. 100% implemented in C# as a managed .NET Control. Document/View/Tool architecture with many properties&events. Optional automatic layout.
Dundas Software
Dundas Chart for .NET is the most advanced .NET charting package available today.  With an extremely complete feature set, elegant architecture and easy implementation, Dundas Chart can quickly add advanced Charting functionality to enhance and transform ASP.NET and Windows Forms applications.  Whether you are implementing charting into internal projects, or building applications for clients, Dundas Chart offers advanced technology and advanced results to get the most out of data.
Clickatell's SMS Gateway
Clickatell's Developer Solutions allow you to SMS enable any website or application via a range of API's. Learn More about our API connections.
Free access to .NET Memory Management video
Everything you need to know about Garbage Collection, Temporary Objects, Fragmentation, Finalization and common causes of memory leaks in .NET. Watch the video here.
Microsoft Visual Studio 2010 Professional
Microsoft Visual Studio 2010 Professional will launch on April 12, but you can beat the rush and secure your copy today by pre-ordering at the affordable estimated retail price of $549 (US). Pre-order now.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Developer-Ready ASP.NET 2.0 Web Hosting with 3 MONTHS FREE
Now supporting .NET 3.0 Framework with Windows Workflow Foundation, Windows Communication Foundation (WCF), Windows Presentation Foundation (WPF), windows CardSpace (WCS)! Providing more flexibility for Developers with Web Services Support and a User/Permission Manger. Also supporting MS SQL 2005/2000 with Real-Time Backups, FREE Automated Attach .MDF Tool, FREE SQL Restore and Shrink SQL DB Tools, and SQL
 
   Print Read/Post comments Post a comment  Similar Articles  
   Email to a friend  Bookmark  Author's other articles  
Download Files:
COBOLCODEBYNRS.zip
 
 Post a Feedback, Comment, or Question about this article
Subject:  
Comment:  
Click Here for 6 Months Free! Powerful ASP.NET Hosting at your Fingertips!
Become a Sponsor
 Comments

 Hosted by MaximumASP  |  Found a broken link?  |  Contact Us  |  Terms & conditions  |  Privacy Policy  |  Site Map  |  Suggest an Idea  |  Media Kit
Current Version: 5.2009.6.2
 © 2010  contents copyright of their authors. Rest everything copyright Mindcracker. All rights reserved.