Professional Documents
Culture Documents
Nancy Stern
the 1976 United States Copyright Act without the
express permission of the copyright owner is
unlawful. Request for further information should
be addressed to the permissions Department ,
Hofstra University John Wily & Sons, Inc. The purchaser may make
back-up copies for his/her own use only and not
for distribution or resale. The Publisher assumes
no responsibility for errors, omissions, or
Nassau Community
College 9th Edition
PowerPoint Presentation:
Richard H. Baum, Ph.D.
DeVry Institute of Technology
CHAPTER 16
Improving Program
Performance Using
The COPY, CALL, and
Other Statements
• CALL STATEMENT
– Why Use a CALL Statement?
– Format of the CALL Statement
• Called Program Requirements
• Calling Program Requirements
Solution: COPY
Structured COBOL Programming, Stern & Stern, 9th Ed
ition
SELF-TEST
Solution: T
EXIT PROGRAM.
• The last executed statement in the called
program must be the EXIT PROGRAM.
– It signals the computer to return control back
to the calling program.
01 PAYROLL-REC.
05 NAME-OUT.
10 LAST-NAME PIC X(20).
10 FIRST-NAME PIC X(15).
10 MIDDLE-INITIAL PIC X.
UNSTRING Format
UNSTRING identifier-1
[DELIMITED BY [ALL]{identifier-2}{literal-1}
[OR [ALL] {identifier-3}{literal-2}]...]
INTO identifier-4...
[END-UNSTRING]
A. COPY Statement
1. To copy entries stored in a library to a user
program.
2. ENVIRONMENT, DATA, and PROCEDURE
DIVISION entries may be copied.
3. Most often used for copying standard file and
record description entries or modules to be
used in the PROCEDURE DIVISION.
4. The format is: COPY text-name {OF}{IN}
library-name.
Structured COBOL Programming, Stern & Stern, 9th Ed
ition
CHAPTER SUMMARY
B. CALL Statement
1. To call or reference entire programs stored in a
library.
2. The user program is referred to as the calling
program; the program accessed from the library will
serve as a subprogram and is referred to as the called
program.
3. To pass data from the called program to the calling
program.
a. The CALL statement can include a USING clause that
lists the names of the fields in the calling program that
are passed to the called program and fields that will be
passed back from the called program.