Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 5: Data Division


DATA DIVISION

  • The DATA DIVISION is used to define data items (variables) to be used by COBOL program. You cannot use data item or variable in PROCEDURE DIVISION unless that data item is described in DATA DIVISION
  • DATA DIVISION is also used to describe record structure of file, constants(literals), temporary variables and program parameters
  • When coded, DATA DIVISION must follow ENVIRONEMENT DIVISION
  • The DATA DIVISION is optional to specify
  • DATA DIVISION is divided into number of sections and depending on the use of the data item, it should be described in the appropriate section
  • The DATA DIVISION has four important sections:-
    1. FILE SECTION :- To describe file record structure
    2. WORKING-STORAGE SECTION :- To describe constants, end-of-file indicators, temp variables. Data items describe in this section get initialized only for the first invocation of the program in the run unit
    3. LOCAL-STORAGE SECTION :- It is similar to WORKING-STORAGE SECTION and it is also used to describe variables but only difference is they get initialized for every invocation of the program in the run unit
    4. LINKAGE SECTION :- To define program parameters i.e. variables whose values are passed by run JCL or calling program
  • The basic structure of DATA DIVISION is given below:-

    DATA DIVISION. [FILE SECTION. [file-section-entry.]…] [WORKING-STORAGE SECTION. [ws-section-entries.]…] [LOCAL-STORAGE SECTION. [local-storage-entries.]…] [LINKAGE SECTION. [linkage-section-entries.]…]

  • The division headings, section headings must begin in Margin A and can be continued to Margin B of coding sheet.
  • Each of sections mentioned in above structure will be explained later. You can refer to link : FILE SECTION , WORKING-STORAGE SECTION , LOCAL-STORAGE SECTION , LINKAGE SECTION . But before explaining these section, it is necessary to understand few concepts and clauses which is used in above specified four sections of DATA DIVISION for variable declaration, initialization etc.



Advertisements






© copyright mainframebug.com
Privacy Policy