8/12/2019 Cob Basics
1/14
8/12/2019 Cob Basics
2/14
TITLE : Introduction to COBOL
Purpose:
To provide introduction to COBOL Language.
To provide context where its uses might be understood.
To provide an introduction to the major characteristicsof a COBOL program
OBJECTIVES:
To be aware of the significance of COBOL and its
divisions
To be aware of COBOL coding rules
How to run a COBOL program in MVS environment
Unit1
8/12/2019 Cob Basics
3/14
What is COBOL
The word COBOLis an acronym that stands forCOmmon Business Oriented Language
COBOL is a high-level programming language first developed
by the CODASYL Committee (COnference on Data SYstemsLanguages) in 1960
Three ANSI standards for COBOL have been produced: in1968, 1974 and 1985.
A new COBOL standard introducing object-orientedprogramming to COBOL, is due within the next few years
Designed for business oriented applications
8/12/2019 Cob Basics
4/14
Significance of COBOL
For over four decades COBOL has been the dominantprogramming language in the business computing domain
In 1997 they estimated that there were about 300 billion lines
of computer code in use in the world. Of that they estimatedthat about 80% (240 billion lines) were in COBOL and 20%
(60 billion lines) were written in all the other computer
languages combined
2004-2005 15% of all new applications (5 billion lines) will be
developed in COBOL while 80% of alldeployed applications
will include extensions to existing legacy (usually COBOL)
programs.
8/12/2019 Cob Basics
5/14
Significance of COBOL
COBOL applications often run in critical areas of business.For instance, over 95% of financeinsurance data is processedwith COBOL
COBOL applications often deal with enormous volumes of
data. Single production files and databases measured interabytes are not uncommon.
COBOL contains such English-like structural elements asverbs, clauses, sentences, sections and divisions.
COBOL is a simple language
COBOL has a 30 year proven track record for applicationmaintenance, enhancement and production support at theenterprise level.
8/12/2019 Cob Basics
6/14
Anatomy of COBOL Program
Divisions
Sections
Paragraphs
Sentences
Statements
8/12/2019 Cob Basics
7/14
Anatomy of COBOL Program
DivisionsA division is a block of code, usually containing one or moresections, that starts where the division name is encounteredand ends with the beginning of the next division
SectionsA section is a block of code usually containing one or more
paragraphs. A section begins with the section name and endswhere the next section name is encountered. A section name is
followed by the word SECTION
8/12/2019 Cob Basics
8/14
Anatomy of COBOL Program
ParagraphsA paragraph is a block of code made up of one or moresentences. A paragraph begins with the paragraph name andends with the next paragraph or section name
Sentences
A sentence consists of one or more statements and isterminated by a period.
StatementsA statement consists of a COBOL verb
8/12/2019 Cob Basics
9/14
COBOL coding rules
Traditionally, COBOL programs were written on coding formsand then punched on to punch cards
The first six character positions are reserved for sequencenumbers.
Column 7 is used for special purpose
An entire line can be designated as comment by placing a *
While printing, Source listing can be ejected to a new pageby placing a /
Used for continuation of non numeric literals
Columns 8-72 are used to write the coding instructions
Columns 73-80 are used for identification
8/12/2019 Cob Basics
10/14
COBOL coding rules
Columns 8-11 is called Area A or Margin A
Columns 12-72 is called Area B or Margin B
Entries of Area A should start between the columns 8-11 andcan extend to Area B
Entries of Area B should start between columns 12-72
All division names, section names, paragraph names, FDentries and 01 level numbers must start in Area A.
All other sentences must start in Area B.
8/12/2019 Cob Basics
11/14
8/12/2019 Cob Basics
12/14
COBOL Divisions
The IDENTIFICATION DIVISION supplies informationabout the program to the programmer and the compiler
The ENVIRONMENT DIVISION is used to describe theenvironment in which the program will run.
The DATA DIVISION provides descriptions of the data-itemsprocessed by the program
The PROCEDURE DIVISION contains the code used tomanipulate the data described in the DATA DIVISION. It ishere that the programmer describes his algorithm
8/12/2019 Cob Basics
13/14
How to Run COBOL program in MVS
Compile the program using JCL (Job Control Language)
Generate the Load module with the help of Bind JCL
Run the program using Exec statement in JCL.
8/12/2019 Cob Basics
14/14
Sample JCL
//IGYWC PROC LNGPRFX='IGY.V2R2M0',SYSLBLK=3200
//*
//*COMPILE A COBOL PROGRAM
//*
//*PARAMETER DEFAULT VALUE USAGE
//*SYSLBLK 3200 BLKSIZE FOR OBJECT DATA SET//*LNGPRFXIGY.V2R2M0 PREFIX FOR LANGUAGE DATA SET
NAMES
//*
//*CALLER MUST SUPPLY //COBOL.SYSIN DD ...
//*//COBOL EXEC PGM=IGYCRCTL,REGION=2048K
//STEPLIB DD DSNAME=&LNGPRFX..SIGYCOMP,
//DISP=SHR
//SYSPRINT DD SYSOUT=*