Vyoms OneStopTesting.com - Testing EBooks, Tutorials, Articles, Jobs, Training Institutes etc.
OneStopGate.com - Gate EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopMBA.com - MBA EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopIAS.com - IAS EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopSAP.com - SAP EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopGRE.com - of GRE EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
Bookmark and Share Rss Feeds

Why Object Orientation for COBOL? | Articles | Recent Articles | News Article | Interesting Articles | Technology Articles | Articles On Education | Articles On Corporate | Company Articles | College Articles | Articles on Recession
Sponsored Ads
Hot Jobs
Fresher Jobs
Experienced Jobs
Government Jobs
Walkin Jobs
Placement Section
Company Profiles
Interview Questions
Placement Papers
Resources @ VYOMS
Companies In India
Consultants In India
Colleges In India
Exams In India
Latest Results
Notifications In India
Call Centers In India
Training Institutes In India
Job Communities In India
Courses In India
Jobs by Keyskills
Jobs by Functional Areas
Learn @ VYOMS
GATE Preparation
GRE Preparation
GMAT Preparation
IAS Preparation
SAP Preparation
Testing Preparation
MBA Preparation
News @ VYOMS
Freshers News
Job Articles
Latest News
India News Network
Interview Ebook
Get 30,000+ Interview Questions & Answers in an eBook.
Interview Success Kit - Get Success in Job Interviews
  • 30,000+ Interview Questions
  • Most Questions Answered
  • 5 FREE Bonuses
  • Free Upgrades

VYOMS TOP EMPLOYERS

Wipro Technologies
Tata Consultancy Services
Accenture
IBM
Satyam
Genpact
Cognizant Technologies

Home » Articles » Why Object Orientation for COBOL?

Why Object Orientation for COBOL?








Article Posted On Date : Monday, March 26, 2012


Why Object Orientation for COBOL?
Advertisements

Why OO?

"Why is Microsoft interested in having so many languages target the new environment? Why bother with a language as old as COBOL?" The answer lies in recognizing that most businesses do not have the luxury of rewriting their large code base every time they want to extend the use of their existing applications.

 By supporting the new Microsoft .NET Framework, Fujitsu Software is endorsing Microsoft's philosophy that programmers want and need to be able to use the programming language best suited to their application. With an estimated 70 percent of production business applications written in COBOL, the answer to enhancing those applications lies not in throwing out the COBOL, but in finding better ways to make it do new things.

 With that support, Fujitsu Software enhances the productivity of organizations that use COBOL. Not only will COBOL programmers have access to a wide variety of new technologies, including .NET class libraries and ASP.NET, they will be able to work seamlessly with developers of code in other languages, such as C++ and Visual Basic. Instead of having a development organization with a schism between COBOL programmers and other programmers, the new environment allows programmers to bridge the barriers using common interfaces and programming tools. The transition to OO COBOL opens up the world for COBOL to be accessed by many other languages and to open itself up as well. Within .NET an OOCOBOL program can inherit from any other language or be inherited.  Business logic will no longer "have to be rewritten because it's in COBOL", but merely recompiled and made accessible.

 This article reviews the processes necessary to migrate from a procedural oriented paradigm to an object-oriented one. Presented are the minimal steps necessary to convert to the object-oriented environment. We will limit the discussion to the steps necessary to convert a procedural program to an object oriented class. Let's begin...

The Beginning

The evolution of objected orientation has been occurring in all development arenas, COBOL included. Object Orientation, more commonly referred to as OO, is an evolutionary development of the paradigm of coding technology. Object orientation enables the software developer to more accurately describe the application they are working on in real-world terms, rather than in abstract terms more suited to a computer.

Our example will utilize a procedural based program to access an ISAM file and return a record. We will first convert the procedural program to an object-oriented program. This program can then be registered as a COM server and called by client programs written in COBOL or other languages, including ASP.NET or VB.NET or C#.

Procedural Code Updates

The original source code is presented in the attached Zip file and is named PROCED.COB. Please refer to it.

The program opens a data file, prompts for input from the screen, searches the data file and then displays an error message or the data returned from the file.

 There are several changes that must be made to the source code to transform it into an OO COBOL module. Several new identifiers will be added to the source module, while a few will be changed to reflect a new name. In a simplified method of converting procedural source code to object-oriented source code, there are generally ten (10) items that require updating.

    Class-ID. The original identifier was PROGRAM-ID. The line should be updated to read: CLASS-ID. {name} AS "{project.source}". Where {name} is the name of the COBOL program. For our example we will name our Class AREACODE, and where {project.source} are the names of our project file, which is Dotnet and the physical name of our source code file, which is areacode.

    A REPOSITORY statement has been added to the CONFIGURATION SECTION. A Repository is used to list any outside classes this class may refer to.

    A reference has been added to the Repository to enable us to notify the system when an exception has occurred in processing. The .NET environment has over 5,000 namespaces each dealing with a specific area within the environment. By utilizing these areas a programmer can save a great deal of time in the designing and coding of common tasks. This module will provide the interface to the exception handling built into .NET so we can easily notify the client when an exception has occurred.

    The class we have added  is the "System.ArguementException" class to be used to raise the exception, or error..

    An Object statement has been added after the Repository section.

    This defines the start of the actual object or program that will be instantiated when the  NEW method is invoked.

    A PROCEDURE DIVISION for the Object must be added.

    We also need to insert a Method-ID statement and name the new method. We will use the name GETSTATECODE. Every class must have at least one method. You can think of a method as being similar to an Entry Point. A Class can have multiple methods and each must have a unique name.

    +Tip
     When naming Methods, try to use a naming convention. It doesnt matter what format you use as long as you are consistent.

    An ENVIRONMENT DIVISION has been added for the Object.

    Next we move to the Data Division. There are several changes that must be made to the DATA DIVISION due the change in definition of this module to a called module. The first change will be to update the WORKING-STORAGE SECTION. We will add object references and error handling variables for the module. Our new WORKING-STORAGE SECTION will now appear as thus:



    The next step is to add a LINKAGE SECTION.

    The LINKAGE SECTION will be used to pass parameters to and from the DLL to the calling module. For our example we will add the following LINKAGE SECTION



    We need to update the original Procedure Division statement to accept the entered area code and return the State code. We also need to be able to notify the client that an error has occurred. To enable this functionality we need to update the Procedure Division header to the following:



    Finally, we need to add three lines to the end of the program to end the Method, Object and class. These lines look like:


If your existing procedural code has been designed such that the User Interface (UI), business logic, file access and error handling routines are separate distinct modules then the above ten (10) items are generally the minimum amount of code you will add or update in a procedural source module to change it to an object-oriented module. In our example this was not the case. Our sample contained UI, error handling as well as file access routines. It was necessary therefore to perform some additional minor changes to the source module. We modified the source code to contain the following error handling routine


Next, we modified the source to not utilize any UI, but rather to utilize the above error routine. For purposes of demonstration the file access routines remained in the source module.

The updated program is present in the Zip file and is named AREACODE.COB. Please refer to the zip file.

It should also be noted that not all of your procedural code would need to be updated to an OO paradigm. Only those modules that would provide benefit to your application would  require this conversion. In our example the file access routines could be removed and a new COBOL source module created. The code in the file access routine would not be required to be OO as it would be a called module and could remain in its procedural form. Prior to under taking a migration to OO-based COBOL a review of your application should be done to determine which modules should be converted to OO and what additional  functionality could be obtained from the migration.

The move to OOCOBOL doesn't have to be a difficult one. Take a few minutes and review the sample in the attached zip file. Try it with one of your own programs and you'll see... it won't hurt.






Sponsored Ads



Interview Questions
HR Interview Questions
Testing Interview Questions
SAP Interview Questions
Business Intelligence Interview Questions
Call Center Interview Questions

Databases

Clipper Interview Questions
DBA Interview Questions
Firebird Interview Questions
Hierarchical Interview Questions
Informix Interview Questions
Microsoft Access Interview Questions
MS SqlServer Interview Questions
MYSQL Interview Questions
Network Interview Questions
Object Relational Interview Questions
PL/SQL Interview Questions
PostgreSQL Interview Questions
Progress Interview Questions
Relational Interview Questions
SQL Interview Questions
SQL Server Interview Questions
Stored Procedures Interview Questions
Sybase Interview Questions
Teradata Interview Questions

Microsof Technologies

.Net Database Interview Questions
.Net Deployement Interview Questions
ADO.NET Interview Questions
ADO.NET 2.0 Interview Questions
Architecture Interview Questions
ASP Interview Questions
ASP.NET Interview Questions
ASP.NET 2.0 Interview Questions
C# Interview Questions
Csharp Interview Questions
DataGrid Interview Questions
DotNet Interview Questions
Microsoft Basics Interview Questions
Microsoft.NET Interview Questions
Microsoft.NET 2.0 Interview Questions
Share Point Interview Questions
Silverlight Interview Questions
VB.NET Interview Questions
VC++ Interview Questions
Visual Basic Interview Questions

Java / J2EE

Applet Interview Questions
Core Java Interview Questions
Eclipse Interview Questions
EJB Interview Questions
Hibernate Interview Questions
J2ME Interview Questions
J2SE Interview Questions
Java Interview Questions
Java Beans Interview Questions
Java Patterns Interview Questions
Java Security Interview Questions
Java Swing Interview Questions
JBOSS Interview Questions
JDBC Interview Questions
JMS Interview Questions
JSF Interview Questions
JSP Interview Questions
RMI Interview Questions
Servlet Interview Questions
Socket Programming Interview Questions
Springs Interview Questions
Struts Interview Questions
Web Sphere Interview Questions

Programming Languages

C Interview Questions
C++ Interview Questions
CGI Interview Questions
Delphi Interview Questions
Fortran Interview Questions
ILU Interview Questions
LISP Interview Questions
Pascal Interview Questions
Perl Interview Questions
PHP Interview Questions
Ruby Interview Questions
Signature Interview Questions
UML Interview Questions
VBA Interview Questions
Windows Interview Questions
Mainframe Interview Questions


Copyright © 2001-2024 Vyoms.com. All Rights Reserved. Home | About Us | Advertise With Vyoms.com | Jobs | Contact Us | Feedback | Link to Us | Privacy Policy | Terms & Conditions
Placement Papers | Get Your Free Website | IAS Preparation | C++ Interview Questions | C Interview Questions | Report a Bug | Romantic Shayari | CAT 2024

Fresher Jobs | Experienced Jobs | Government Jobs | Walkin Jobs | Company Profiles | Interview Questions | Placement Papers | Companies In India | Consultants In India | Colleges In India | Exams In India | Latest Results | Notifications In India | Call Centers In India | Training Institutes In India | Job Communities In India | Courses In India | Jobs by Keyskills | Jobs by Functional Areas

Testing Articles | Testing Books | Testing Certifications | Testing FAQs | Testing Downloads | Testing Interview Questions | Testing Jobs | Testing Training Institutes

Gate Articles | Gate Books | Gate Colleges | Gate Downloads | Gate Faqs | Gate Jobs | Gate News | Gate Sample Papers | Gate Training Institutes

MBA Articles | MBA Books | MBA Case Studies | MBA Business Schools | MBA Current Affairs | MBA Downloads | MBA Events | MBA Notifications | MBA FAQs | MBA Jobs
MBA Job Consultants | MBA News | MBA Results | MBA Courses | MBA Sample Papers | MBA Interview Questions | MBA Training Institutes

GRE Articles | GRE Books | GRE Colleges | GRE Downloads | GRE Events | GRE FAQs | GRE News | GRE Training Institutes | GRE Sample Papers

IAS Articles | IAS Books | IAS Current Affairs | IAS Downloads | IAS Events | IAS FAQs | IAS News | IAS Notifications | IAS UPSC Jobs | IAS Previous Question Papers
IAS Results | IAS Sample Papers | IAS Interview Questions | IAS Training Institutes | IAS Toppers Interview

SAP Articles | SAP Books | SAP Certifications | SAP Companies | SAP Study Materials | SAP Events | SAP FAQs | SAP Jobs | SAP Job Consultants
SAP Links | SAP News | SAP Sample Papers | SAP Interview Questions | SAP Training Institutes |


Copyright ©2001-2024 Vyoms.com, All Rights Reserved.
Disclaimer: VYOMS.com has taken all reasonable steps to ensure that information on this site is authentic. Applicants are advised to research bonafides of advertisers independently. VYOMS.com shall not have any responsibility in this regard.