Cobol. By: Steven Conner. COBOL, COmmon Business Oriented Language, one of the. oldest programming languages, was designed in the last six



Similar documents
Base Conversion written by Cathy Saxton

Computer Science 281 Binary and Hexadecimal Review

COWLEY COLLEGE & Area Vocational Technical School

Everything you wanted to know about using Hexadecimal and Octal Numbers in Visual Basic 6

Database Programming with PL/SQL: Learning Objectives

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement?

COBOL. COBOL (Common Business Oriented Language) was one of the earliest high-level programming languages.

Oracle Database: SQL and PL/SQL Fundamentals

Oracle Database: SQL and PL/SQL Fundamentals

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

VHDL Test Bench Tutorial

Oracle Database: SQL and PL/SQL Fundamentals NEW

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Web Development using PHP (WD_PHP) Duration 1.5 months

Programming Languages

EE 261 Introduction to Logic Circuits. Module #2 Number Systems

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

VISUAL GUIDE to. RX Scripting. for Roulette Xtreme - System Designer 2.0

Chapter 5 Names, Bindings, Type Checking, and Scopes

PROG0101 Fundamentals of Programming PROG0101 FUNDAMENTALS OF PROGRAMMING. Chapter 3 Algorithms

I PUC - Computer Science. Practical s Syllabus. Contents

2 SYSTEM DESCRIPTION TECHNIQUES

Moving from CS 61A Scheme to CS 61B Java

Course MS10975A Introduction to Programming. Length: 5 Days

3.GETTING STARTED WITH ORACLE8i

Oracle 10g PL/SQL Training

Introduction to Python

6.170 Tutorial 3 - Ruby Basics

Kids College Computer Game Programming Exploring Small Basic and Procedural Programming

Chapter One Introduction to Programming

=

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share.

Relative and Absolute Change Percentages

Legacy System: Migration Strategy

C Programming. for Embedded Microcontrollers. Warwick A. Smith. Postbus 11. Elektor International Media BV. 6114ZG Susteren The Netherlands

The first time through running an Ad Hoc query or Stored Procedure, SQL Server will go through each of the following steps.

Introduction to Python

CS 241 Data Organization Coding Standards

Storing Measurement Data

Oracle Database: SQL and PL/SQL Fundamentals NEW

3 SOFTWARE AND PROGRAMMING LANGUAGES

Chapter 13: Program Development and Programming Languages

The Hexadecimal Number System and Memory Addressing

The programming language C. sws1 1

Decimal to Binary Conversion

Visual Logic Instructions and Assignments

Oct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8

Chapter 2: Algorithm Discovery and Design. Invitation to Computer Science, C++ Version, Third Edition

PROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 TUTORIAL OUTCOME 2 Part 1

CSC408H Lecture Notes

CS 111 Classes I 1. Software Organization View to this point:

Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff

Sources: On the Web: Slides will be available on:

ALLIED PAPER : DISCRETE MATHEMATICS (for B.Sc. Computer Technology & B.Sc. Multimedia and Web Technology)

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C

1 Description of The Simpletron

ARIZONA CTE CAREER PREPARATION STANDARDS & MEASUREMENT CRITERIA SOFTWARE DEVELOPMENT,

Visual Basic. murach's TRAINING & REFERENCE

Guide to Upsizing from Access to SQL Server

Algorithms, Flowcharts & Program Design. ComPro

Ohio University Computer Services Center August, 2002 Crystal Reports Introduction Quick Reference Guide

You can probably work with decimal. binary numbers needed by the. Working with binary numbers is time- consuming & error-prone.

HOMEWORK # 2 SOLUTIO

Advanced Tornado TWENTYONE Advanced Tornado Accessing MySQL from Python LAB

Unix Shell Scripts. Contents. 1 Introduction. Norman Matloff. July 30, Introduction 1. 2 Invoking Shell Scripts 2

Concepts in IP Addressing...

Fundamentals of Java Programming

Number Conversions Dr. Sarita Agarwal (Acharya Narendra Dev College,University of Delhi)

Course Title: Software Development

CGN Computer Methods

Introducing Microsoft SQL Server 2012 Getting Started with SQL Server Management Studio

CSE 373: Data Structure & Algorithms Lecture 25: Programming Languages. Nicki Dell Spring 2014

Querying Microsoft SQL Server

NF5-12 Flexibility with Equivalent Fractions and Pages

CHAPTER 1 Overview of SAS/ACCESS Interface to Relational Databases

CALCULATIONS & STATISTICS

Java Basics: Data Types, Variables, and Loops

Java Application Developer Certificate Program Competencies

Welcome to Basic Math Skills!

Introduction to Java Applications Pearson Education, Inc. All rights reserved.

Guide to SQL Programming: SQL:1999 and Oracle Rdb V7.1

Informatica e Sistemi in Tempo Reale

McGraw-Hill The McGraw-Hill Companies, Inc.,

Chapter 13: Program Development and Programming Languages

Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies)

4.3 TABLE 3 TABLE five

1 Introduction. 2 An Interpreter. 2.1 Handling Source Code

AQA GCSE in Computer Science Computer Science Microsoft IT Academy Mapping

Binary Representation. Number Systems. Base 10, Base 2, Base 16. Positional Notation. Conversion of Any Base to Decimal.

Object Oriented Software Design

Microsoft Excel 2010 Part 3: Advanced Excel

PHP Tutorial From beginner to master

Section of DBMS Selection & Evaluation Questionnaire

Lab 4.4 Secret Messages: Indexing, Arrays, and Iteration

Named Memory Slots. Properties. CHAPTER 16 Programming Your App s Memory

Querying Microsoft SQL Server 2012

Chapter 6: Programming Languages

Course ID#: W 35 Hrs. Course Content

Transcription:

Cobol By: Steven Conner History: COBOL, COmmon Business Oriented Language, one of the oldest programming languages, was designed in the last six months of 1959 by the CODASYL Committee, COnference on DAta SYstems Languages. COBOL s specifications were strongly inspired by the language FLOW MATIC. It was developed for the United States government and businesses during the arms race of the cold war, while the Soviet Union used APL, Address Programming Language. However, even though COBOL was developed by 1960, COBOL didn t have a standardized version until 1968 when ANSI, American National Standard Institute, took over the responsibility of developing new COBOL standards and COBOL 68/ANS COBOL was developed. Since COBOL was first developed it has undergone four standardizations. ANS COBOL/COBOL 68 mostly just fixed problems of incompatibility with different versions COBOL by making a standard version. COBOL 74 just added a lot of new features not included in COBOL 68. COBOL 85 also added in new features. Most importantly the

structured language constructs, END IF, END PERFORM, END READ, etc. COBOL 2002/OO COBOL, Object Oriented COBOL. This new version was approved by ISO, International Organization for Standardization, and like the name implies, it allows Object Oriented programming for COBOL. However, a new standardized library is being worked on but the expected time of completion was 2007 but the new standard has not yet been approved. Even though COBOL is over fifty years old, it is still used in a majority of businesses in the United States and the United Kingdom. There are over 200 billion lines of running COBOL code with an annually addition of 5 billion lines of code. Overview: Coding: A COBOL program is divided into four division. These divisions are the IDENTIFICATION DIVISION, ENVIRONMENT DIVISION, DATA DIVISION, PROCEDURE DIVISION. In the IDENTIFICATION DIVISION the only thing required is the program name but this division also normally contains the programmer s name, the date, and intended purpose. In the ENVIRONMENT DIVISION you tell the program what it will interact with. This

can include but not limited to files, printers, other computer, etc. This division is split into two sections, the CONFIGURATION SECTION which deals with the source and object computer, normally the same thing and doesn t need to be included, and the INPUT OUTPUT SECTION deals which all other interactions. Next is the DATA DIVISION which is also divide into two sections. The FILE SECTION which deals with how all info retrieved from a file or being sent to a file will be formatted and handled, and the WORKING STORAGE SECTION which deals with all other piece of data. The last division is called the PROCEDURE DIVISION and it is well all the actual programming takes place. In the PROCEDURE DIVISION the program is broken up into paragraphs or modules. You use Perform to call these paragraphs but may only call paragraphs below the call and once a paragraph has finish if no call was issued again the the program jumps back up to the last call and drops down one line. Name, Scope, Binding: Names in COBOL must begin with a letter and can be a maximum of 30 characters long. The name can be composed of letters from A Z (all uppercase), numbers 0 9, and hyphens ( ). The scope of COBOL doesn t exist. COBOL has no scope but if you had to give it a scope it would be

static. COBOL only deals with binding when accessing SQL for information. Data Types: COBOL has only three basic data types declared after the PICture clause, A alpha, X alpha numeric, 9 numeric. These data types can be declared as DISPLAY or COMPUTATION with the use of USAGE. Display is implied as long as the data type isn t declared as Computation. Display is used to show the data, while Computation is used for computing the data in the form of Comp, or Comp 1 through Comp 5 most commonly used is Comp and Comp 3. Comp which is also Comp 4, stores binary data that is normally used in indexes, switches, or arithmetic and Comp3 being a packed decimal which is normally used for a fix value arithmetics. Comp 1 and Comp 2 are short and long, respectively, floating points that can be stored in IEEE format or hexadecimal format. While COMP 5 is used to store data values from files that might not fit PIC structure. A S for sign and V for an implied decimal point, can also be inserted in the pic clause if it being used as DISPLAY. ex. Weekly Pay PIC $9(5)v99 USAGE DISPLAY Expressions and Assignment Statements: COBOL allows a wide variety of ways to write expression and assignment

statements from using the familiar symbols like =,*,+,,/ to keeping to its English syntax by using ADD, SUBTRACT, DIVIDE, MULTIPLY, MOVE, COMPUTE, BY, TO FROM, and INTO. COBOL also allows you to mix and match as you see fit but a good COBOL programmer uses the same statement format throughout the whole program. Control Structures: COBOL has fewer control structures than most other languages but enough to get the job done. Just like the expression and assignment statements control structures in COBOL have both a word and symbol form, </LESS, >/GREATER, <=/LESS OR EQUAL, >=/GREATER OR EQUAL, =/EQUAL, NOT=/NOT EQUAL. These statements are used in COBOL just like in most other languages and are used to compare values. COBOL also has three logical operators, AND, NOT, OR. These logic operators are used inside IF statement to allow more control and easier coding due to only having to write one IF statement instead of two or more. The AND statement makes it so all values must be true while an OR statement allows an IF statement to pass as long as one of the values is true. The NOT statement makes a true value false and a false value true. The selection statements in COBOL are, IF, THEN, ELSE, END IF, ACCEPT, EVALUATE, WHEN, WHEN OTHER, END EVALUATE, EXIT, and

UNTIL. These statement are actually a huge part of the COBOL language. They are what allows the program to handle different situations of data. The EXIT statement is used to return to the line right after the last PERFORM statement. The IF statement is the biggest exception handling and allows for the program to head in different directions. The EVALUATE statement is used whenever multiple actions, more than three, can be executed because of a piece of data. For example taxes on paygrades. ACCEPT PAY EVALUATE WHEN PAY IS GREATER OR EQUAL TO 45000 MOVE 32 INTO TAXES WHEN PAY IS GREATER OR EQUAL TO 30000 MOVE 27 INTO TAXES WHEN OTHER MOVE 23 INTO TAXES END EVALUATE. Subprograms: In COBOL subprograms are written as an entirely separate program and include a linkage section which is what accepts data from the main program and can return data to the main program. You can pass data to a subprogram two

ways, REFERENCE or CONTENT. All local variables in a subprogram are static and are only refreshed if the subprogram call is preceded by a CANCEL or an INITIAL statement. ex. CALL SUBPROGRAM USAGE BY CONTENT FNAME, MINT, LNAME Abstract Data Types and Encapsulation Constructs: Cobol doesn t have them. Support for Object Oriented Programming: COBOL has support for object oriented programming through its newest update called Object Oriented COBOL, however it s as different as C/C++ and C#. OO COBOL gives you Classes, Objects, Methods, Inheritance, and Polymorphism. But since OO COBOL is still being changed/added on to and it s like its own branch off language, thats as far as OO COBOL will be discussed. Concurrency: COBOL uses LOCKS and TRANSACTIONS. LOCKS are used to keep data from being changed while doing something else in the program or to allow only certain things, the statements READ WITH NO LOCK and START WITH NO LOCK, the rights to change the data. LOCK is generally used in companies to stop co workers from changing the data while you are working with it, but still leaves access for workers above you to change the data. TRANSACTIONS are used to remember how the data was before the process started and is used to restore the

data if the TRANSACTION fails. Exception Handling: COBOL has no integrated exception handling. A user can add in any exception handler that the user wants into the source code but the user has to self implement them. Examples of this are ON OVERFLOW, ON???? ERROR, and AT END*, each of this can be used for exception handling. However, the easiest way for exception handling is by using the IF and END IF statement to catch any problem where you think one could happen. This does increase the lengthiness of COBOL programs but allows for specific handling and the IF and END IF statement still has to be used with above stated handlers if you use the above handlers. ex: IF ON OVERFLOW(VALUE) DISPLAY OVERFLOW ERROR STOP RUN ELSE END IF. Evaluation: Read ability: While the data variables can be a little hard to read with the PIC clause. The rest of the COBOL language is very readable as it can be typed using words and

not symbols. Writability: AS said before COBOL can have a near english syntax making writing in it feel more natural. You can even use periods to end a loop, if, when, etc statements. (All but END_PROGRAM) can be replaced. However it doesn t have functions so you get repeated code unless you know the language really well, but you would lose some read ability. Reliability: COBOL might not be the easiest or shortest or most powerful language but it does get the job done. Which is why after 50 years it is still going strong and is still used in most big businesses in the United States and the United Kingdom. Cost: While COBOL is a relatively easy language to learn, not many people are learning it anymore. So some companies have to train their employees in how to write COBOL. But even with the additional cost of training some employees, the cost is still drastically below what it would cost to convert COBOL code to a more modern language.

Reference: http://www.csis.ul.ie/cobol/course/cobolintro.htm. Coughlan, Michael. Introduction to COBOL, Cobol Tutorial. April, 2002. http://www.csee.umbc.edu/courses/graduate/631/fall2002/cobol.p df. Li, Jiehong & Abraham, Rona. COBOL. Fall, 2002.