Monday, May 25, 2020

Division of Cobol

Identification Division :-   mandatory

IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.                 //used to Identify the programs

Environment Division :-   Input and output files used in programs

ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
   SOURCE-COMPUTER. XXX-ZOS.   //System used to compile program
   OBJECT-COMPUTER. XXX-ZOS.    //System used to execute program

INPUT-OUTPUT SECTION.
   FILE-CONTROL.                                //Provide information of external dataset used in program
   SELECT FILEN ASSIGN TO DDNAME
   ORGANIZATION IS SEQUENTIAL.


I-O control -  provides info of files used in program  //extra

Data Division :-   define variables used in programs

DATA DIVISION.
   FILE SECTION.               //define record structure of file
   FD FILEN
   01 NAME PIC A(25).
   
   WORKING-STORAGE SECTION.  //define temporary variables used in programs
   01 WS-STUDENT PIC A(30).
   01 WS-ID PIC 9(5).

LOCAL-STORAGE SECTION. // same as working storage -variable allocated everytime 
   01 LS-CLASS PIC 9(3).           //when program execution start
   
   LINKAGE SECTION.    //describe the data name received from external programs
   01 LS-ID PIC 9(5).


Procedure Division :- Include logic of programs

PROCEDURE DIVISION.
   A000-FIRST-PARA.
   DISPLAY 'Hello World'.
   MOVE 'TutorialsPoint' TO WS-NAME.
   DISPLAY "My name is : "WS-NAME.
   DISPLAY "My ID is : "WS-ID.
STOP RUN.







No comments:

Post a Comment