Sunday, 12 August 2012

Introduction to COBOL



Introduction to COBOL

COBOL stands for Common Business oriented language introduced in 1960. It is simple English type language.

Structure of COBOL language is:






And every sentence is divided into statements like below.



Like English sentence each COBOL sentence is end with full stop.

What is scope of COBOL in today’s market ?

As technology like JAVA,DOT NET etc. In the market and these are new technology and COBOL is old but then also COBOL dominating in today’s market handling  most of the business application.

What are the Divisions used in COBOL program ?

In COBOL there are 80 columns to code your program.




Column no. 1 - 6 is reserved for sequence number.
7 is for comment line,new line etc.
8 -11 is Area “A” here all division name, section name, paragraph name etc.must start here.
12-72 is Area “B” where all statements, sentences, group elements etc. must start here.
72-80 is comment line compiler will ignore this.

There are 4 division in COBOL.

1) Identification Division
2) Environment Division
3) Data Division
4) Procedure division.


Structure of COBOL program:






What is IDENTIFICATION DIVISION?

This division is for identification of your program. This is first division in COBOL program tells the compiler that below are the details of my program which i want to execute.
Below are the fields in IDENTIFICATION DIVISION.




Program name must be unique so that it can be called by other program.

What is Environment Division?

Here you are describing the environment for program compilation and execution.

Divided into 2 sections.

1)Configuration section.

2)Input-Output section.





What is DATA Division ?

It divides into 2 section.

1)Working-storage section.
Here you declare all variables that going to used in program.


2)File  Section.

Here structure of file that we are accessing in program.





What is Procedure Division ?

Procedure Division contains actual logic of your program to be executing.

It contains instruction which are executing one by one.

Procedure Division.
Instruction1.
Instruction2.
So on.
Procedure division uses variable that we declared in working-storage section.
Once you complete your program logic then you write STOP RUN. To tell the compiler that this is my last statement to execute.












No comments:

Post a Comment