100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Programming

Working-Storage Section

How the WORKING-STORAGE SECTION declares a COBOL program's in-memory variables, initial values, flags, and constants that persist for the life of the run unit.

Data & VariablesBeginner8 min readJul 10, 2026
Analogies

Purpose of the Working-Storage Section

The WORKING-STORAGE SECTION is where a COBOL program declares every variable that is not directly part of a file's record layout: loop counters, accumulator totals, status flags, switches, and literal constants. Unlike FILE SECTION items, which only hold meaningful data while a record is actually read into the buffer, WORKING-STORAGE items are allocated once when the program loads and retain their values across the entire run unit unless explicitly changed. This makes WORKING-STORAGE the workhorse section of most business programs, since payroll totals, error counters, and control-break flags all live here rather than in the FILE SECTION.

🏏

Cricket analogy: WORKING-STORAGE is like a scorer's running tally sheet for the whole innings, kept separate from the printed scorecard template, tracking things like current partnership and overs bowled that only exist for this match.

Declaring Variables with the VALUE Clause

Every WORKING-STORAGE item can carry an optional VALUE clause that assigns an initial value at program load time, something FILE SECTION items cannot do since their contents come from the file itself. Numeric fields commonly initialize with VALUE ZERO or a specific literal like VALUE 100, while alphanumeric fields initialize with VALUE SPACES or a quoted literal like VALUE 'PENDING'. Figurative constants such as ZERO, SPACES, HIGH-VALUES, and LOW-VALUES are COBOL reserved words that expand to fill the entire receiving field regardless of its size, so VALUE SPACES on a PIC X(50) field blanks out all fifty positions without the programmer counting characters.

🏏

Cricket analogy: The VALUE clause is like a scoreboard operator setting every digit to zero before the umpire calls play, ensuring WS-RUNS starts at a known state rather than whatever was left from the last match.

Constants, Flags, and Counters

In practice, WORKING-STORAGE fills with a handful of recurring patterns: end-of-file flags like WS-EOF-FLAG PIC X VALUE 'N', paired with an 88-level condition name like WS-EOF-YES for readable PERFORM UNTIL tests; running accumulators like WS-TOTAL-AMOUNT PIC 9(9)V99 VALUE ZERO that get added to inside a read loop; and true constants declared once and never reassigned, such as WS-TAX-RATE PIC V999 VALUE .075. Grouping related WORKING-STORAGE items under a single 01-level group, for example 01 WS-COUNTERS with subordinate 05-level fields for records read, records written, and records rejected, keeps the section organized and makes it easy to DISPLAY the whole group at once for debugging.

🏏

Cricket analogy: An end-of-innings flag like WS-EOF-FLAG is like the umpire's signal that the tenth wicket has fallen, a single readable switch that cleanly ends the batting loop for that side.

cobol
       WORKING-STORAGE SECTION.
       01  WS-EOF-FLAG              PIC X VALUE 'N'.
           88  WS-EOF-YES           VALUE 'Y'.
           88  WS-EOF-NO            VALUE 'N'.

       01  WS-COUNTERS.
           05  WS-RECORDS-READ      PIC 9(6) VALUE ZERO.
           05  WS-RECORDS-WRITTEN   PIC 9(6) VALUE ZERO.
           05  WS-RECORDS-REJECTED  PIC 9(6) VALUE ZERO.

       01  WS-TOTAL-AMOUNT          PIC 9(9)V99 VALUE ZERO.
       01  WS-TAX-RATE              PIC V999 VALUE .075.
       01  WS-STATUS-MSG            PIC X(20) VALUE SPACES.

       PROCEDURE DIVISION.
           PERFORM UNTIL WS-EOF-YES
               READ CUSTOMER-FILE
                   AT END SET WS-EOF-YES TO TRUE
                   NOT AT END
                       ADD 1 TO WS-RECORDS-READ
               END-READ
           END-PERFORM
           DISPLAY 'RECORDS READ: ' WS-RECORDS-READ.

Scope and Lifetime

By default, WORKING-STORAGE items in a COBOL program initialize once, at the very first CALL of that program within a run unit, and retain their values across subsequent CALLs unless the program is compiled with the INITIAL keyword on PROGRAM-ID, which forces a fresh copy of WORKING-STORAGE on every invocation. This distinction matters enormously for subprograms called repeatedly in a loop: a non-INITIAL program's accumulator will keep growing across calls unless it is deliberately reset, which is a frequent bug source in batch systems that call the same subroutine thousands of times per run. LOCAL-STORAGE SECTION, by contrast, always reinitializes on every call and is the standard choice for reentrant CICS transaction programs where multiple concurrent users must never share state.

🏏

Cricket analogy: A non-reset WORKING-STORAGE accumulator across repeated CALLs is like a bowler's over-count that keeps climbing match after match if nobody resets it back to zero for the new fixture.

The VALUE clause only sets the initial value when the program is first loaded (or on every call for an INITIAL program or LOCAL-STORAGE items). It does not re-run every time PROCEDURE DIVISION executes, so counters must be explicitly reset with MOVE ZERO or INITIALIZE if they need to restart within the same run.

A common legacy defect is a subprogram called repeatedly inside a batch loop whose WORKING-STORAGE accumulator was never reset, silently carrying totals from one invocation into the next. Always verify whether a called subprogram is INITIAL or relies on caller-driven resets before trusting its running totals.

  • WORKING-STORAGE SECTION declares in-memory variables, flags, counters, and constants used throughout PROCEDURE DIVISION.
  • The VALUE clause sets an item's initial value at load time; figurative constants like ZERO and SPACES fill the whole field.
  • 88-level condition names attached to flag fields make PERFORM UNTIL loops far more readable than raw comparisons.
  • Grouping related fields under one 01-level item keeps WORKING-STORAGE organized and easy to DISPLAY for debugging.
  • By default, WORKING-STORAGE values persist across repeated CALLs within a run unit unless the program is INITIAL.
  • LOCAL-STORAGE SECTION always reinitializes per call, making it the standard choice for reentrant CICS programs.
  • Forgetting to reset an accumulator between calls is a classic source of legacy batch-processing bugs.

Practice what you learned

Was this page helpful?

Topics covered

#Programming#COBOLStudyNotes#WorkingStorageSection#Storage#Section#Purpose#Declaring#StudyNotes#SkillVeris#ExamPrep

Frequently Asked Questions

21 categories · pick one to explore

Where can I get free study notes for programming and tech subjects?
SkillVeris offers completely free study notes covering programming and tech subjects, with no signup fees or paywalls. The notes are structured by course and topic, written for quick understanding, and enriched with the Learn Through Hobbies analogy method, so you can revise concepts through cricket, music, gaming, cooking and more.
Are SkillVeris study notes good for exam revision?
Yes, the study notes are designed for efficient revision: each topic answers its heading immediately, keeps explanations concise, and links to related glossary terms and cheat sheets. Students preparing for university exams or certification tests use them as quick revision notes because they distil concepts without the padding of full textbooks.
What subjects do the free study notes cover?
The study notes span the platform's main domains, including AI and machine learning, Python and programming, web development, DevOps, cloud, security and databases. Coverage mirrors the 37 live courses, so notes exist for the topics you are actually studying, and new note sets are added as courses launch.
How are SkillVeris study notes different from regular textbooks?
The notes are answer-first, concise and free, whereas textbooks are long and often expensive. Each section explains one concept directly, then reinforces it through selectable hobby analogies like cricket or cooking. Notes also cross-link to the glossary, blog and cheat sheets, letting you jump to related material instantly instead of flipping pages.
Can I use the developer study material without creating an account?
The study notes are free to access, and SkillVeris does not charge anything for its developer study material at any point. Browsing notes is straightforward from the Study Notes section, and if you want progress tracking, certificates and AI Mentor conversations tied to your learning, a free account unlocks those extras.
Do the study notes explain concepts with analogies?
Yes, this is a signature SkillVeris feature. Study notes use the Learn Through Hobbies method, explaining technical concepts through analogies from twelve domains including cricket, music, gaming, photography, travel, movies, fitness, chess, cooking, finance, business and sports. You can switch the analogy domain instantly to whichever hobby makes the concept click.
Are the revision notes suitable for last-minute exam preparation?
Yes, revision notes on SkillVeris work well for last-minute preparation because every section states the answer in its first sentences, so skimming is genuinely effective. Pair them with the relevant cheat sheet for formulas and syntax, and use the glossary for any unfamiliar term you meet while cramming.
Is there free study material for AI and machine learning?
Yes, SkillVeris provides free study notes across its AI and ML catalogue, covering Python for AI, deep learning frameworks like PyTorch and TensorFlow, Hugging Face Transformers, Large Language Models, RAG, AI agents and MLOps. All of it is free, making it a strong resource for Indian students and global learners alike.
Can beginners understand the study notes, or are they for experts?
Beginners can absolutely use them. The notes are written in plain language, define terms as they appear, and lean on hobby analogies to make abstract ideas concrete. Difficulty scales with the underlying course level, so beginner-course notes stay gentle while advanced-course notes go deeper, and the glossary supports you throughout.
How do study notes connect with SkillVeris courses?
Study notes are organised by course and topic, so they map directly to the structured courses and their 24–40-lesson curriculum. Many learners study a lesson first, then use the matching notes for revision before module assessments and the final exam, where 80 percent is required to pass and earn the certificate.
Are there study notes for Python specifically?
Yes, Python is well covered through notes tied to the Python-focused courses, including Python for AI and ML. Topics span fundamentals through applied machine learning usage. You can reinforce the notes with Python practice in Code Lab, which runs code in your browser with no installation required.
Do the study notes include code examples?
Yes, study notes include code examples wherever a concept is best shown in code, alongside explanations, key points and analogies. Reading a snippet in the notes and then reproducing it yourself in Code Lab is an effective loop, since Code Lab lets you run code in the browser across six languages.
How often is new study material added to SkillVeris?
Study material grows alongside the course catalogue. Whenever new courses join the platform's 37 live courses, matching study notes, glossary entries and cheat sheets are added so the resources stay in sync. Existing notes are also refined over time, so it is worth revisiting topics you studied earlier.
Can I use SkillVeris notes to prepare for technical interviews?
Yes, the notes make excellent interview revision because they compress each concept into direct, answer-first explanations, which mirrors how you should answer interview questions. Combine them with the SkillVeris interview questions feature, which includes readiness scoring, to test whether your revision has actually made you interview-ready.
Are the study notes mobile-friendly for studying on the go?
Yes, the study notes are built to load fast and read comfortably on mobile devices, so you can revise during a commute or between classes. Sections are short and answer-first, which suits small screens, and analogy switching works on mobile too, letting you study anywhere without carrying books.
What is the difference between study notes and cheat sheets?
Study notes explain concepts in depth with context, examples and analogies, making them ideal for learning and revision. Cheat sheets are compact quick-reference summaries of syntax, commands and key facts, ideal once you already understand a topic. Most learners study the notes first, then keep the cheat sheet handy while coding.
Do study notes help if I am stuck on a course lesson?
Yes, reading the matching study notes often clarifies a lesson because the same concept is explained from a different angle, frequently with a different analogy. If you are still stuck, ask the AI Mentor, which answers 24/7 at Quick, Detailed or Deep-dive depth until the idea genuinely makes sense.
Is there free study material for DevOps and cloud topics?
Yes, SkillVeris carries free study notes for DevOps and cloud topics as part of its coverage across 37 live courses. The material suits learners following the DevOps Engineer or Cloud Engineer paths, and it links to related glossary terms and cheat sheets so you can revise the whole toolchain in one place.
Can school or college students in India use these notes for projects?
Yes, students across India and worldwide use SkillVeris notes for coursework, projects and exam preparation, and everything is free, which matters for student budgets. The notes explain concepts clearly enough to cite in project reports, and Code Lab lets you prototype the project code directly in your browser.
How should I combine study notes with other SkillVeris resources?
A proven loop: learn from a course lesson, revise with the matching study notes, look up unfamiliar terms in the glossary, keep the cheat sheet open while practising in Code Lab, and quiz yourself with interview questions. The AI Mentor fills any remaining gaps 24/7, at whatever depth you need.

What Learners Say

Real journeys from the SkillVeris community — swipe for more.

SkillVeris taught me Python through Cricket. Now I’m building real projects and feeling confident!
Arjun S. · B.Tech Student
The best platform for hobby-based learning. Concepts finally stick.
Priya R. · Data Analyst
I went from zero coding to a portfolio of projects — all by learning through my love for gaming. Landed my first internship!
Kabir M. · CS Undergraduate
Trending Topics50 popular tags — tap to explore
Trending CoursesAll 37 free courses — tap to browse