Introduction to COBOL


COBOL provides very powerful file handling features. COBOL features like variable length records, Indexed and sequential files with unlimited number of records. This makes COBOL very efficient in commercial data processing. COBOL programs are so much like plain English that even a person with no programming knowledge would be able to understand a COBOL program. The same reason also makes COBOL very easy to learn and programs easy to maintain. COBOL is self-documenting. Which means that very little additional documentation is required with a COBOL program. COBOL is used on almost all platforms. PC’s, Minis, Mainframes, all support COBOL. A programmer would have to only look at some minor differences to shift from one machine to another.

1.1 COBOL Program Layout

    1.1.1 Columns 1 to 6 - Line Number
       1.1.2 Columns 7th - Indicator Columns. A ‘*’ is use to comment the line.
       1.1.3 Columns 8 to 11 - Area A
       1.1.4 Columns 12 to 72- Area B
       1.1.5 Column 73 onwards - The compiler ignores whatever is written in these columns
 

1.2. COBOL program Structure

      - COBOL programs are divided in four divisions.
                IDENTIFICATION DIVISION.
                ENVIRONMENT DIVISION.
                DATA DIVISION.
                PROCEDURE DIVISION.

        - The divisions are divided in sections, sections in paragraphs, paragraphs in sentences and sentences in words. Words are made up of the COBOL character set.
        - All division, section and paragraph names are written in Area A. All sentences are written in area B.

1.2.1 IDENTIFICATION DIVISION

      i.e.
        IDENTIFICATION DIVISION.
        PROGRAM-ID. Program-name.
        AUTHOR. ABC.
        INSTALLATION. Comment-entry
        DATE-WRITTEN. Comment-entry
        DATE-COMPILED. Comment-entry
        SECURITY. Comment-entry
 

The first paragraph of the identification division must be the PROGRAM-ID paragraph. The other paragraphs are optional, but, when written, must appear in the order shown as above.

1.2.2 ENVIRONMENT DIVISION

There is no mandatory entry in this division. There are some entries can be written under this division.

Example:
    ENVIRONMENT DIVISION.
    CONFIGURATION SECTION.
    SOURCE-COMPUTER. IBM-AS400.
    OBJECT-COMPUTER. IBM-AS400.
    INPUT-OUTPUT SECTION.
 

Back to Crystal Report Topics

 

Google