Presentation is loading. Please wait.

Presentation is loading. Please wait.

Module 1 1. Cobol Hierarchy Revised on 2011. 1. COBOL Hierarchy There are four DIVISIONS:- IDENTIFICATION DIVISION. ENVIRONMENT DIVISION. DATA DIVISION.

Similar presentations


Presentation on theme: "Module 1 1. Cobol Hierarchy Revised on 2011. 1. COBOL Hierarchy There are four DIVISIONS:- IDENTIFICATION DIVISION. ENVIRONMENT DIVISION. DATA DIVISION."— Presentation transcript:

1 Module 1 1. Cobol Hierarchy Revised on 2011

2 1. COBOL Hierarchy There are four DIVISIONS:- IDENTIFICATION DIVISION. ENVIRONMENT DIVISION. DATA DIVISION. PROCEDURE DIVISION. If the division is not used, the division header need not to be specified. The last two division, namely DATA DIVISION and PROCEDURE DIVISION will comprise 95% of a program.

3 1. COBOL Hierarchy IDENTIFICATION DIVISION (Program Identification). Serve a single purpose, the division header is mandatory according to the ISO standard but optional under Net Express. ENVIRONMENT DIVISION (Operating Environment). Serve to identify the environment in which program will operate. Files which the program will use from part of the operating environment and will therefore be specified in this division. DATA DIVISION (Data Descriptions). All the data that the program uses will be defined in this division. PROCEDURE DIVISION (Algorithm Descriptions). All the instruction that will manipulate the data reside in this division.

4 1. COBOL Hierarchy IDENTIFICATION DIVISION (Program Identification) Syntax. The IDENTIFICATION DIVISION has the following structure:- IDENTIFICATION DIVISION.Represent the division header and signal the commencement of the program text. PROGRAM-ID. NameOfProgram.Is a keyword. It must be specified immediately after the division header. The program name can be up to 30 characters long. [AUTHOR. YourName.]

5 1. COBOL Hierarchy IDENTIFICATION DIVISION (Program Identification) Syntax. Example:- IDENTIFICATION DIVISION. PROGRAM-ID. SequenceProgram. AUTHOR. Alan Cheah Kah Hoe

6 1. COBOL Hierarchy ENVIRONMENT DIVISION (Operating Environment) Syntax. The ENVIRONMENT DIVISION is divided into two main sections:- 1. CONFIGURATION SECTION. 2. INPUT-OUTPUT SECTION - Is used to specify the file environment in which the program is to function.  A file is specified using the select statement.  There will be a select statement for each file used in the program.

7 1. COBOL Hierarchy DATA DIVISION (Data Descriptions) Syntax. The DATA DIVISION has the following structure:- DATA DIVISION.Represent the division header and signal the commencement of the program text. FILE SECTION. File Section entries.Is a keyword. It must be specified immediately after the division header. The program name can be up to 30 characters long. WORKING-STORAGE SECTION. WS entries.

8 1. COBOL Hierarchy DATA DIVISION (Data Descriptions) Syntax. Example:- IDENTIFICATION DIVISION. PROGRAM-ID. SequenceProgram. AUTHOR. Fosha Sondha. DATA DIVISION. WORKING-STORAGE SECTION. 01 Num1PIC 9VALUE ZEROS. 01 Num2PIC 9VALUE ZEROS. 01 ResultPIC 99VALUE ZEROS.

9 1. COBOL Hierarchy PROCEDURE DIVISION (Algorithm Descriptions) Syntax. The PROCEDURE DIVISION is where all the data described in the DATA DIVISION is produced and being processed. Besides, this is where the programmer describes his algorithm. The PROCEDURE DIVISION is hierarchical in structure and consists of:-  Sections sections is optional.  Paragraphs  Sentences at least one.  Statements In PROCEDURE DIVISION paragraph and section names are chosen by the programmer. The names used should reflect the processing being done in the paragraph or section.

10 1. COBOL Hierarchy PROCEDURE DIVISION (Algorithm Descriptions) Syntax. Example:- IDENTIFICATION DIVISION. PROGRAM-ID. SequenceProgram. AUTHOR. Fosha Sondha. DATA DIVISION. WORKING-STORAGE SECTION. 01 Num1PIC 9VALUE ZEROS. 01 Num2PIC 9VALUE ZEROS. 01 ResultPIC 99VALUE ZEROS. PROCEDURE DIVISION. CalculateResult. ACCEPT Num1. ACCEPT Num2. MULTIPLY Num1 BY Num2 GIVING Result. DISPLAY “Result is = “, Result. STOP RUN.

11 Lab Exercise 1 How to display “Hello World”? How do you start a new program in Net Express? Please try it yourself first before I show you the correct program.


Download ppt "Module 1 1. Cobol Hierarchy Revised on 2011. 1. COBOL Hierarchy There are four DIVISIONS:- IDENTIFICATION DIVISION. ENVIRONMENT DIVISION. DATA DIVISION."

Similar presentations


Ads by Google