Copybook

From Wikipedia, the free encyclopedia

A copybook in the computer programming language COBOL is a text-based program file that is most frequently used to describe the physical layout of data in an output file, input file, or shared between programs. While primarily used to define file layouts (schemas), COPYBOOKs can also be used to contain instructions.

The term may have originated with IBM mainframe operating systems, where the "copybook" item was stored as a "book" within a larger library of source code [1].

The term "copybook" is mainly used in a COBOL or IBM mainframe context.

A copybook is functionally equivalent to an #include file, as used in C or C++ [2].

Major reasons for using COPYBOOKs are to:

  • ensure that everyone uses the same version of a file layout definition.
  • make it easier to cross reference where components (both data structures and functional instructions) are used.

[edit] Syntax

The copybook is invoked in COBOL by the COPY statement, which has two forms:

  1. COPY text-name.
  2. COPY text-name REPLACING item BY item.

The COPY REPLACING provides a simple replacement facility.

copy copybook replacing ==item1== by ==item2==

[edit] References

  • "BEA WebLogic Integration Glossary", Version 2.1. unsigned. BEA Systems, Inc., October 2001. [3], accessed: 2006/07/06.