You are on page 1of 15

BASIC COBOL PROGRAMMING

CHAMBER 3
Basic COBOL – Module 1
CHAMBER 3

Introduction to COBOL

COBOL Structure

Coding Rules
Learning Objectives

By the end of this session the participant


will be able to
 Understand the use of COBOL language
 Know about COBOL Structure
 Understand the coding rules for COBOL

3
Introduction to COBOL

COmmon
Business
Oriented
Language

4
Introduction to COBOL

 Mainlyused for developing business, file-


oriented data processing application
 High level computer language
 English like language

5
Introduction to COBOL - Contd

 Various versions of COBOL


 VS COBOL-74
 VS COBOL-85
 VS COBOL II
 OS COBOL
 LE COBOL

6
COBOL Structure
Program

Divisions

Section(s)

Paragraph(s)

Sentence(s)

Statement(s)

7
COBOL Structure

 Division(s)

A block of code contains one or more


sections

 Section(s)

A block of code contains one or more


paragraphs

8
COBOL Structure
 Paragraph(s)

A block of code made up of one or more


sentences
 Sentence(s) and Statement(s)
A sentence consists of one or more
statements and is terminated by a period
A statement consists of a COBOL verb and
an operand or operands

9
COBOL Structure

 IDENTIFICATION DIVISION
 Identifies program to operating system
 Provides documentation about program

 ENVIRONMENT DIVISION
 Defines file-names
 Describes devices used to store them

10
COBOL Structure

 DATA DIVISION
 Describes input and output format of data in
files
 Defines any constants and work areas

 PROCEDURE DIVISION
 Contains the program algorithms

11
COBOL - Coding Rules
 Any instruction in COBOL Program is 1 to 80 characters (columns)
long. This area is divided as follows…

 Column 1-6 For Line Numbers (Optional)


 Column 7 ‘*’ For Comment Line
 ‘/’ For Page Eject
 ‘-’ For Continuation of literal
 Column 8-11 Area A
 Column 12-72 Area B
 Column 73-80 Identification entry (Optional)

12
Name Rules
 Section name/Paragraph Name
 User defined words

 Can be maximum 30 character long

 Letters, Digit and ‘–’ only

 No embedded blanks

 At least one alphabetic character

 No COBOL reserved words (like FILLER, RENAMES)

13
Winding up
 COBOL
 As language

 Usage

 Structure
 Division

 Section

 Paragraph

 Statement

 Sentence

 Coding rules

14
CHAMBER 3

Thank You

You might also like