1 / 21

IDENTIFICATION AND ENVIRONMENT DIVISION

Introduction. The IDENTIFICATION AND ENVIRONMENT DIVISION are the first two leading divisions of any COBOL program. These divisions contain entries that are required to either identify the program or describe the computer system to be used for the compilation and execution of the program.. IDENTIFICATION DIVISION.

Mia_John
Download Presentation

IDENTIFICATION AND ENVIRONMENT DIVISION

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


    1. IDENTIFICATION AND ENVIRONMENT DIVISION

    2. Introduction The IDENTIFICATION AND ENVIRONMENT DIVISION are the first two leading divisions of any COBOL program. These divisions contain entries that are required to either identify the program or describe the computer system to be used for the compilation and execution of the program.

    3. IDENTIFICATION DIVISION The IDENTIFICATION DIVISION is the first division of every COBOL source program. The paragraph PROGRAM-ID is essential in most of the machines. The other paragraphs are optional.

    4. The structure of Identification division

    5. First two lines are required for all COBOL programs. Rest all paragraphs are optional. PROGRAM-ID. <-- Need to provide the program name Ex. PROGRAM-ID. COBOL. The division heading and paragraph names should be coded as margin A entries. The entries following the paragraph headings must be terminated by a period. The entry in the PROGRAM-ID paragraph contains the program name to be used to identify the object program.

    6. PROGRAM-ID The PROGRAM-ID header is required. The purpose of this header is to name the program. AUTHOR The purpose of this optional header is to identify the author of the program.

    7. INSTALLATION The INSTALLATION would be the name of the company, where the COBOL Software Program was designed and written. DATE-WRITTEN The purpose of this optional header is to document the date the program was written.

    8. DATE-COMPILED The purpose of this optional header is to document the compilation date of the program. SECURITY The purpose of this optional header is to document the security requirements of the program.

    9. REMARKS The purpose of this optional header is to allow for the inclusion of general comments about the program. REMARKS are useful for describing the basic function, input and output files, and modifications made to the program. Instead of a REMARKS paragraph, many programmers use an asterisk in column 7 to represent a comment.

    10. ENVIRONMENT DIVISION The ENVIRONMENT DIVISION is the second division in a COBOL source program. It is the most machine-dependent division. The computer and all peripheral devices required by the program are described in this division. This division contains two sections: 1) CONFIGURATION SECTION and 2) INPUT-OUTPUT SECTION.

    11. The structure of Environment division

    12. ENVIRONMENT DIVISION This division contains two optional SECTIONS: 1. CONFIGURATION SECTION. Specifies the characteristics of your computer system. 2. INPUT-OUTPUT SECTION. Relates file names used in the program to the external file names.

    13. The division headings, section headings and the paragraph headings should be coded as Margin A entries. The paragraph headings must be followed by a period and then a space. The entries in the paragraphs are Margin B entries and can start in the same line with the paragraph heading.

    14. CONFIGURATION SECTION The configuration section describes the hardware on which the program is to run and on which it is to be compiled. The source computer is the computer on which the program is to be compiled. The object computer is the one on which the program is to run. There are three paragraphs in this section, namely: source-computer, object-computer and special names.

    15. SOURCE-COMPUTER This paragraph specifies the name of the computer used to compile the COBOL program. The following is the form of this paragraph. SOURCE-COMPUTER. computer-name. For example, if ICL 1901 is to be used for compiling the COBOL source program, this paragraph should be as follows: SOURCE-COMPUTER. ICL-1901

    16. OBJECT-COMPUTER The OBJECT-COMPUTER paragraph describes the computer on which the program is to be executed. The following shows the syntax for this paragraph. OBJECT-COMPUTER. Computer-name. For example, if ICL 1901 is to be used for compiling the COBOL source program, this paragraph should be as follows: OBJECT-COMPUTER. ICL-1901

    17. Special Names The Special Names paragraph designates a mnemonic name to a predefined function name. It can be used in the WRITE statement for skipping to a new page.

    18. INPUT-OUTPUT SECTION The Input-Output Section is used to specify information necessary for controlling the transfer of data between the object program and an I-O device. There are two paragraphs in this section- 1) FILE-CONTROL and 2) I-O-CONTROL. The INPUT-OUTPUT SECTION is optional in many computers.

    19. FILE-CONTROL The FILE-CONTROL paragraph names each file and identifies the first medium through file control entries. The simplified format of a file control entry is given below. SELECT [OPTIONAL] file-name ASSIGN TO hardware-name.

    20. SELECT The SELECT clause chooses a file in the COBOL program to be associated with an external medium. OPTIONAL You may specify SELECT OPTIONAL only for files opened in the I-O mode. You must specify SELECT OPTIONAL for those input files that are not necessarily present each time the object program is executed.

    21. file-name File-name must be an FD entry in the Data Division. File-name must conform to the rules for a COBOL user-defined name, must contain at least one alphabetic character, and must be unique within this program. ASSIGN Clause The ASSIGN clause associates a file with an external medium. An example FILE-CONTROL. SELECT PRINTER-FILE ASSIGN TO PRINTER.

    22. *********************** ************* Thanks

More Related