Chapter 10. THE COPY AND CALL STATEMENTS
CHAPTER OBJECTIVES
Upon completion of this chapter, you should be able to
Explain the purpose of the COPY statement and describe its use.
Demonstrate the COPY statement for copying a source member into a program.
Explain the purpose of the CALL statement and describe its use.
Demonstrate how the CALL statement is used for dynamic and static program calls.
THE COPY STATEMENT
The COPY statement is used to bring into a program a source member consisting of a series of prewritten COBOL statements. The COBOL source member is copied from a source file that is stored in a library. Copying a source member, rather than coding the statements directly in the program, has the following benefits: (1) it saves a software developer a considerable amount of coding and debugging time; (2) it promotes program standardization since all programs that use the source member will be using common data-names and/or procedures; (3) it reduces the time it takes to make modifications and reduces duplication of effort; if a change needs to be made to the code, it can be made just once in the source member without the need to alter individual programs; and (4) source members are extensively annotated so that they are meaningful to all users; this annotation results in better-documented programs and systems.
Most often, the COPY statement is used to copy FD and 01 entries that define and describe files and records. In addition, standard modules to be used in the PROCEDURE DIVISION ...
Get PROGRAMMING IN COBOL/400: 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.