3.2 The ENVIRONMENT DIVISION

This division tells the computer what the program will be interacting with (i.e. its environment) such as printers, disk drives, other files etc... As such, there are two important sections: the CONFIGURATION SECTION (which defines the source and object computer) and the INPUT-OUTPUT SECTION (which defines printers, files that may by used and assigns identifier names to these external features).



     000260 ENVIRONMENT DIVISION.
     000270 CONFIGURATION SECTION.
     000280 SOURCE-COMPUTER.   IBM PC.
     000290 OBJECT-COMPUTER.   IBM PC.
     000300 INPUT-OUTPUT SECTION.
     000310 FILE-CONTROL.
     000320    SELECT INPUT-FILE ASSIGN TO 'input.dat'
     000330      ORGANIZATION IS LINE SEQUENTIAL.
     000340    SELECT PRINT-FILE ASSIGN TO PRINTER.

Notes:



Things look clearer when you see a full program (see Sample Code section).


1. Getting started 7. File handling
2. COBOL basics 8. Debugging COBOL
3. The Four Divisions 9. Useful links
4. Defining Data Part 1 10. Sample Code
5. Defining Data Part 2 11. Feedback
6. Commands and logic 12. Quick reference
   Awards    HOME
Copyright Timothy R P Brown 2000 - 2005: Web design in Glasgow, Scotland by 404i