Skip to content
COBOL

WORKING-STORAGE

The section of a COBOL program that declares its internal variables: counters, totals, flags and work areas.

Also written WORKING-STORAGE SECTION

WORKING-STORAGE SECTION is where a COBOL program declares the variables it uses for its own purposes, as opposed to the records it reads and writes.

Everything a program needs to hold while it runs is here: accumulators for totals, subscripts for loops, switches recording whether the end of a file has been reached, formatted fields for printing, and constants such as messages and table values.

The storage is allocated once and persists for the whole run. A variable keeps its value between paragraphs and across iterations of a loop unless something changes it, and initialising values explicitly rather than assuming them is a habit worth forming early.

Values can be set at declaration time, which is how constants and lookup tables are defined.

By convention, names here are given prefixes marking what they are, whether a switch, a counter or a work field, so that reading the PROCEDURE DIVISION tells you what kind of thing each name refers to without looking it up. Site standards for this vary, but nearly every site has one.

Browse all 115 terms

Learn this properly.

Use WORKING-STORAGE for real in Mainframe101, in your browser, with Zed beside you. Join the waitlist.

Early access and updates. No spam, unsubscribe any time.