Skip to content
COBOL

Copybook

A shared block of COBOL declarations kept in a library and included into programs, so a record layout is defined once.

Also written COPY, copy member, copylib

A copybook is a piece of COBOL source held as a member in a library and pulled into a program at compile time with a COPY statement. It is COBOL's include mechanism.

Its main use is record layouts. When forty programs read the customer file, all forty need the same field-by-field description of a customer record. Copying that into every program would guarantee they drift apart. Instead, the layout lives in one copybook and every program includes it.

That makes changes tractable. Adding a field means changing the copybook and recompiling the programs that use it. Knowing which programs those are is a standard part of impact analysis before any change goes ahead.

Copybooks also hold shared constants, common working-storage areas and standard blocks of logic used across a site.

When you are reading unfamiliar code, copybooks are essential context. A program that seems to reference undeclared fields is almost always using a copybook, and the field definitions are in the library rather than in front of you.

Browse all 115 terms

Learn this properly.

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

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