Anda di halaman 1dari 11

TITLE : Divisions of COBOL

Purpose:
To provide significance of divisions in a COBOL
program
To provide description about the sections in each
division

OBJECTIVES :
To be aware of structure of each division
Aware of sections and clauses used in each division
Unit2
COBOL Divisions
IDENTIFICATION DIVISION.
Contains program information

ENVIRONMENT DIVISION.
Contains environment information

DATA DIVISION.
Contains data descriptions

PROCEDURE DIVISION.
Contains the program algorithms

Identification Division
Must be the first division in every COBOL source program
Must begin with the words IDENTIFICATION DIVISION

IDENTIFICATION DIVISION.
PROGRAM-ID. <program name>
[AUTHOR.]
[INSTALLATION.]
[DATE-WRITTEN.]
[DATE-COMPILED.]
[SECURITY.]

Name of the Author
Name of the Organization
Program coding date
Program compilation date
Program Name
A user-defined word or nonnumeric literal
that identifies your program.
The name can be up to 30 characters in
length.
Only the hyphen, digit, and alphabetic characters are allowed
in the name.
At least one character must alphabetic.
The hyphen cannot be used as the first or
last character.

Environment Division
Environment Division.
Configuration Section. Describe the computer
environment on which the program
is compiled and executed.
Source-Computer. Describes the computer on which
the source program is to be
compiled.
Object-Computer. Specifies the system for which the
object program is designated.
Input-output section. Depends on the file organization
and access methods used.
File-Control. Names the files and associates them
with the external data sets.
Select clause
File Control
The following are the formats for the FILE-CONTROL
paragraph:
Sequential file entries
Indexed file entries
Relative file entries
It must contain one and only one entry for each file described
in an FD or SD entry in the Data Division.
File Type Access Method
Sequential QSAM, VSAM
Indexed VSAM
Relative VSAM
Data Division
Data Division.

File Section.
FD <filename>

01 Record Description

Working-Storage Section

Linkage Section

Report Section

Screen Section
File Section
The File Section defines the structure of data files.

file-description-entry provides information about the physical
structure and identification of a file, and gives the record-
name(s) associated with that file.

record-description-entry describe the particular record(s)
contained within a particular file.

More than one record description entry can be specified;
Data Division
The Working-Storage Section describes data records that are
not part of data files but are developed and processed by a
program
Data entries in the Working-Storage Section that bear a
definite hierarchic relationship to one another must be grouped
into records structured by level number.
Independent items in the Working-Storage Section that bear no
hierarchic relationship to one another begins with either the
level number 77 or 01.
The Linkage Section describes data made available from
another program
Procedure Division
The PROCEDURE DIVISION is hierarchical in structure and
consists of sections, paragraphs, sentences and statements
There must be at least one paragraph, sentence and statement
in the PROCEDURE DIVISION
Paragraph and section names in the PROCEDURE DIVISION
are chosen by the programmer and must conform to the rules
for user-defined names.
The end of the Procedure Division is indicated by the END
PROGRAM header
Instructions are typically executed in sequence unless a
PERFORM statement is encountered.
A PERFORM paragraph-name is an instruction that
temporarily transfers control to another paragraph

Anda mungkin juga menyukai