Monday, June 16, 2008

The ENVIRONMENT DIVISION

The ENVIRONMENT DIVISION is used to describe the environment in which the program will run.

The purpose of the ENVIRONMENT DIVISION is to isolate in one place all aspects of the program that are dependant upon a specific computer, device or encoding sequence.

The idea behind this is to make it easy to change the program when it has to run on a different computer or one with different peripheral devices.

In the ENVIRONMENT DIVISION, aliases are assigned to external devices, files or command sequences. Other environment details, such as the collating sequence, the currency symbol and the decimal point symbol may also be defined here.


ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. IBM-PC.
OBJECT-COMPUTER. IBM-PC.

INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT ACC-INPUT-FILE
ASSIGN TO INPUT1
ORGANIZATION IS SEQUENTIAL.

SELECT ACC-OUTPUT-FILE
ASSIGN TO OUTPUT1
ORGANIZATION IS SEQUENTIAL.

No comments: