History COBOL (Common Business Oriented Language) was one of the earliest high-level programming languages. COBOL was first proposed in 1959 by the Conference.

Slides:



Advertisements
Similar presentations
DT266/2 Information Systems COBOL Revision. Chapters 1 & 2 Hutty & Spence Divisions of a Cobol Program Identification Division Program-ID. Environment.
Advertisements

DT266/2 COBOL Basics – Declaring Data Basic Operations.
2-1 Chapter 2.  Coding Requirements of IDENTIFICATION DIVISION  Sections of ENVIRONMENT DIVISION  Assigning Files to Devices in ENVIRONMENT DIVISION.
COBOL LANGUAGE COmmon Business Oriented Language Sarunya Dechasajja
- Kav Shrestha.  Introduction  History  Features  COBOL Usage  Characteristics  Structure of COBOL Programs  COBOL Divisions  Data Items  Variable.
BY: JOSHUA THOMAS IGNATIUS TOWERS COBOL. Overview What is COBOL History Design Implementations What did it do Program structure Data types Syntax Sample.
The IDENTIFICATION and ENVIRONMENT DIVISIONS Chapter 2.
Understanding the Mainline Logical Flow Through a Program (continued)
COBOL for the 21 st Century Stern, Stern, Ley Chapter 1 INTRODUCTION TO STRUCTURED PROGRAM DESIGN IN COBOL.
COBOL COmmon Business Oriented Language  Work began in 1959 and has never stopped.
PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert.
Structured COBOL Programming, Stern & Stern, 9th Edition
Structured COBOL Programming, Stern & Stern, 9th edition
4-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
Programming in COBOL-85 For IBM Mainframe System 390
COBOL Basics 1. COBOL coding rules  Almost all COBOL compilers treat a line of COBOL code as if it contained two distinct areas. These are known as;
4-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
2-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
1 Chapter 4. To familiarize you with methods used to 1. Access input and output files 2. Read data from an input file 3. Perform simple move operations.
Chapter To familiarize you with  Why COBOL is a popular business-oriented language.  Programming practices and techniques  History of COBOL.
Introduction to COBOL. COBOL  COBOL is an acronym which stands for Common Business Oriented Language.  The name indicates the target area of COBOL applications.
Modifications to program Addda.cbl Please use speaker notes for additional information!
Programming Examples to Accompany Structure Topic Please use speaker notes for additional information!
COBOL Cobol is one of the most robust language in the software field, so far Cobol turned 50, in 2009 Cobol has stood the test of time Common Business.
Programming in COBOL-85 For IBM Mainframe System 390 Jyothi Sridhar Kini E&R, Infosys Mail-id: Phone:
Lecture 31 Numeric Edited Alphabetic (A) AlphaNumeric (X) Numeric (9, V, S) Numeric Edited (9, Z, comma, decimal point, minus sign) –Z = zero suppressed.
The DATA DIVISION Chapter 3. COBOL Data Organization Field - group of characters forming a meaningful unit or basic fact –Characters in a name or digits.
3-1 Chapter 3. To familiarize you with  Ways in which data is organized in COBOL  Rules for forming data-names  Defining input and output files in.
UNIT 1 UNIT 1 Stephen S. Linkin Houston Community College System 8/28/ Copywrite © Houston Community College System 2007 Graphics Courtesy of IBM.
1 Interactive vs Batch Programs Cobol suited for developing both types of programs Interactive programs Accept input data from keyboard Input data processed.
CS CS Computing for Business Instructor:David Tucker GTA:Batul Mirza.
COBOL Basics 2. H E N N E S S Y R M L M F Group Items/Records StudentDetails WORKING-STORAGE SECTION. 01StudentDetailsPIC X(26).
Indexed and Relative File Processing
COBOL (Common Business Oriented Language). 1. Introduction to COBOL History of COBOL Coding rules Program Structure Data names and Identifiers Figurative.
1 The Procedure Division Chapter 4. 2 Main Two Sections File Section –Used to define files and record formats –Field names within records Working Storage.
Statement Syntax1 THE SELECT STATEMENT Purpose: designates a file and points to its physical location Syntax Definition : SELECT file-name-1 ASSIGN TO.
CPSC3111/CISM3111 COBOL Structured COBOL Programming Text: murach’s structured COBOL Authors: Murach, Prince, Menendez.
1 IDENTIFICATION and ENVIRONMENT DIVISIONS. 2 Objectives Basic Structure of COBOL Programs General Coding and Formatting Rules Identification and the.
Structured Programming
Any Questions!. Test Coming Up! Agenda Printing with Externally Described Printer Files Arrays.
COBOL Screens Please use speaker notes for additional information!
COmmon Business Oriented Language
Structured COBOL Programming, Stern & Stern, 9th Edition CHAPTER 2 Cobol Language Fundamentals.
1 Chapter 5 – The Procedure Division File handling statements –OPEN statement Initiates processing for a file Input Output Each file opened must have been.
PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert.
2-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
1.  Introduction  The Benefits of the Report Writer Module ◦ For Detail and Summary Printing ◦ For Control Break Processing ◦ For Printing Headings.
IBM-Mainframes COBOL Class-1. Background and History  COBOL is an acronym for: Common Business Oriented Language  COBOL was developed in 1959 by the.
Module 1 1. Cobol Hierarchy Revised on COBOL Hierarchy There are four DIVISIONS:- IDENTIFICATION DIVISION. ENVIRONMENT DIVISION. DATA DIVISION.
Lecture 21 ENVIRONMENT DIVISION  defines files external to the program and devices.  contains two sections: 1.CONFIGURATION SECTION.  identifies computers.
Any Questions? Week 1 - 2nd Lecture Intro to COBOL Programming Defining Files and Processing Data.
COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
Analysis of SAMPLE1.CBL Please check speaker notes for additional information!
COMP 430 Intro. to Database Systems Course overview Slides adapted from those by Chris Jermaine.
The PERFORM. The PERFORM Verb  Iteration is an important programming construct. We use iteration when we need to repeat the same instructions over and.
Invent Your Own Computer Games with Python
Week 2/3 - 2nd Lecture Intro to COBOL Programming Defining Files and Processing Data.
371 Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout John.
Random update Please use speaker notes for additional information!
Introduction to Sequential Files. COBOL's forte  COBOL is generally used in situations where the volume of data to be processed is large.  These systems.
General Introduction Algorithms. Let’s write a program  A program is a collection of statements written in a language the computer understands.  A computer.
Structured Programming
Programming in COBOL.
Designing and Debugging Batch and Interactive COBOL Programs
Chapter 3 The DATA DIVISION.
An Introduction to Structured Program Design in COBOL
Structured COBOL Programming
Chapter 14 Sorting and Merging.
CHAPTER 17 The Report Writer Module
Programming in COBOL.
Presentation transcript:

History COBOL (Common Business Oriented Language) was one of the earliest high-level programming languages. COBOL was first proposed in 1959 by the Conference on Data Systems Languages (CODASYL). Three ANSI standards for COBOL have been produced in 1968, 1974 and Object-oriented COBOL is the fourth edition in the continuing evolution of ANSI/ISO standard COBOL.

Underlining Philosophy Like the name suggests, COBOL was meant to be ‘common’ or compatible among a significant group of manufacturers COBOL is designed for developing business, typically file- oriented, applications, and is not designed for writing systems programs.

Advantages -Simple -Portable -Maintainable Disadvantages -very wordy - has a very rigid format -not designed to handle scientific applications

Areas of Applications For over four decades COBOL has been the dominant programming language in the business computing domain. For instance, over 95% of finance-insurance data is processed with COBOL. In 1999 Gartner group reported that over 50% of all new mission-critical applications were still being done in COBOL

Distinct features The language is simple No pointers No user defined types No user defined functions ‘Structure like’ data types File records are also described with great detail, as are lines to be output to a printer COBOL is self documenting

Structure of COBOL COBOL programs are hierarchical in structure. Each element of the hierarchy consists of one or more subordinate elements. The levels of hierarchy are Divisions, Sections, Paragraphs, Sentences and Statements There are 4 main divisions and each division provides an essential part of the information required by the complier

Structure of COBOL (continued) At the top of the COBOL hierarchy are the four divisions. The sequence in which they are specified is fixed, and must follow the order: IDENTIFICATION DIVISION supplies information about the program to the programmer and the compiler. ENVIRONMENT DIVISION is used to describe the environment in which the program will run.

Structure of COBOL (continued) DATA DIVISION provides descriptions of the data-items processed by the program. PROCEDURE DIVISION contains the code used to manipulate the data described in the DATA DIVISION. It is here that the programmer describes his algorithm. Some COBOL compilers require that all the divisions be present in a program while others only require the IDENTIFICATION DIVISION and the PROCEDURE DIVISION

HelloWorld Example IDENTIFICATION DIVISION PROGRAM-ID. HELLOWORLD ENVIRONMENT DIVISION CONFIGURATION SECTION SOURCE-COMPUTER. RM-COBOL OBJECT-COMPUTER. RM-COBOL DATA DIVISION FILE SECTION PROCEDURE DIVISION MAIN-LOGIC SECTION DISPLAY "Hello world!" STOP RUN.

Data Types in COBOL COBOL is not a strongly typed language In COBOL, there are only three data types -numeric -alphanumeric (text/string) -alphabetic Data types are declared using: A level number. A data-name or identifier. A Picture clause. e.g. 01 GrossPay PIC 9(5)V99 VALUE ZEROS.

Group Items Group items are the COBOL equivalent of structures. The items with a group item must be elementary items or other group items. Ultimately every group item should be defined in terms of elementary items. The hierarchy in a group item is represented by different level numbers e.g. 01 DateOfBirth. 02 DayOfBirth PIC MonthOfBirth PIC YearOfBirth PIC 9(2).

Basic Commands ADD a TO b GIVING c. SUBTRACT a FROM b GIVING c. MULTIPLY a BY b GIVING c. DIVIDE a INTO b GIVING c. COMPUTE x = a + b * c. MOVE a TO b c SORT sort-file ON ASCENDING KEY k USING inventory-file GIVING sorted-inventory-file.

Basic Commands (Contd.) MERGE merge-work-file ON ASCENDING KEY K USING input-file1 input-file2 GIVING output-file. DISPLAY total-cost. Accept identifier. PERFORM paragraphname1 THROUGH paragraphname2 VARYING index FROM value1 BY value2 UNTIL condition.

Detailed COBOL example IDENTIFICATION DIVISION PROGRAM-ID. SAMPLE AUTHOR. J.P.E. HODGSON DATE-WRITTEN. 4 February * A sample program just to show the form * The program copies its input to the output, * and counts the number of records * At the end this number is printed

Detailed COBOL example (Contd.) ENVIRONMENT DIVISION INPUT-OUTPUT SECTION FILE-CONTROL SELECT STUDENT-FILE ASSIGN TO SYSIN ORGANIZATION IS LINE SEQUENTIAL SELECT PRINT-FILE ASSIGN TO SYSOUT ORGANIZATION IS LINE SEQUENTIAL DATA DIVISION FILE SECTION FD STUDENT-FILE RECORD CONTAINS 43 CHARACTERS DATA RECORD IS STUDENT-IN STUDENT-IN PIC X(43).

COBOL example (Contd.) FD PRINT-FILE RECORD CONTAINS 80 CHARACTERS DATA RECORD IS PRINT-LINE PRINT-LINE PIC X(80) WORKING-STORAGE SECTION DATA-REMAINS-SWITCH PIC X(2) VALUE SPACES RECORDS-WRITTEN PIC DETAIL-LINE FILLER PIC X(7) VALUE SPACES RECORD-IMAGE PIC X(43) FILLER PIC X(30) VALUE SPACES

COBOL example (Contd.) SUMMARY-LINE FILLER PIC X(7) VALUE SPACES TOTAL-READ PIC FILLER PIC X VALUE SPACE FILLER PIC X(17) VALUE 'Records were read' FILLER PIC X(53) VALUE SPACES PROCEDURE DIVISION PREPARE-SENIOR-REPORT OPEN INPUT STUDENT-FILE OUTPUT PRINT-FILE MOVE ZERO TO RECORDS-WRITTEN READ STUDENT-FILE AT END MOVE 'NO' TO DATA-REMAINS-SWITCH END-READ.

COBOL example (Contd.) PERFORM PROCESS-RECORDS UNTIL DATA-REMAINS-SWITCH = 'NO' PERFORM PRINT-SUMMARY CLOSE STUDENT-FILE PRINT-FILE STOP RUN PROCESS-RECORDS MOVE STUDENT-IN TO RECORD-IMAGE MOVE DETAIL-LINE TO PRINT-LINE WRITE PRINT-LINE ADD 1 TO RECORDS-WRITTEN READ STUDENT-FILE AT END MOVE 'NO' TO DATA-REMAINS-SWITCH END-READ.

COBOL example (Contd.) PRINT-SUMMARY MOVE RECORDS-WRITTEN TO TOTAL-READ MOVE SUMMARY-LINE TO PRINT-LINE WRITE PRINT-LINE