Friday, 12 December 2008

DATA DIVISION:

DATA DIVISION is that part of a COBOL program where every data item processed by the program is described. It is important to note that unless a data item is described in the DATA DIVISION, it cannot be used in the procedure division. The DATA DIVISION is divided into a number of sections and depending on the use of a data item, it should be defined in the appropriate section.

The format of the DATA DIVISION is as follows:

DATA DIVISION.

[ FILE SECTION.

File section entries.

……….

………. ]

[WORKING-STORAGE SECTION.

Working-storage entries.

………

……… ]

(a)FILE SECTION:

The FILE SECTION includes the descriptions of all data items that should be read from or written onto some external file.


(b) WORKING-STORAGE SECTION

LEVEL STRUCTURE:-

The data to be processed are internally stored in a specific area in the memory of a computer.

In COBOL a distinction is made between elementary and group data items. A few elementary data may be combined to form a group. For example, DAY, MONTH and YEAR may be three elementary data items. These may be combined to form a group data named DATE.

The organization may be shown pictorially as follows:

DATE

DAY

MONTH

YEAR

It may be noted that the memory space referred to by DATE is the combined memory space for DAY, MONTH and YEAR.

The programmer can now refer to the individual elementary items DAY, MONTH, YEAR or to the group item DATE.

To describe the hierarchical structure introduced above, the concept of level number is employed in COBOL.

No comments:

Post a Comment