Summary -

In this topic, we described about the Environment Division with detailed example.

ENVIRONMENT DIVISION specifies the computer environment(mostly computer name in mainframe environment) on which the program is compiled and executed.

ENVIRONMENT DIVISION is optional in the COBOL program.

ENVIRONMENT DIVISION also defines file organization and access methods used in the program. In addition, ENVIRONMENT DIVISION describes the input and output sources required to run the program and interaction with devices like printers, files, etc.

ENVIRONMENT DIVISION always supplies the system-dependent information.

ENVIRONMENT DIVISION has two sections -

Syntax -

[Optional]  [source-computer-paragraph]
[Optional]  [object-computer-paragraph]
[Optional]  [special-names-paragraph]]
[Optional]  [file-control-paragraph]
[Optional]  [i-o-control-paragraph]]