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

Module 5: Data Division


WORKING-STORAGE SECTION

  • This section follows FILE SECTION.
  • WORKING-STORAGE SECTION is used to describe constants, end-of-file indicators, temp variables used in programs. Data items describe in this section get initialized only for the first invocation of the program in the run unit
  • WORKING-STORAGE SECTION is used to describe the data items (variables) that program needs for internal manipulation of data.
  • When program execution starts the memory will be allocated to data items described in WORKIN-STORAGE SECTION, and memory will be de-allocated when the program execution completes.
  • Data items described in WORKING-STORAGE SECTION is used internally in program and cannot be used outside the program
  • The basic structure of WORKING-STORAGE SECTION is given below:-

    DATA DIVISION. WORKING-STORAGE SECTION. [ws-section-entries…]

  • Example:-

    DATA DIVISION. WORKING-STORAGE SECTION. 01 DATE VALUE IS “28012018”. 05 DD PIC X(2). 05 MM PIC X(2). 05 YYYY PIC X(4). 01 TOTAL-VALUE PIC 9(10). 01 FILE-STATUS-1 PIC X(02). 01 WS-EOF-SWITCH PIC X(01) VALUE SPACE. 88 EOF-SWITCH VALUE 'Y'.






© copyright mainframebug.com
Privacy Policy