

Preface
OVERALL MARKET
This book is intended for readers with no previous programming or computer experience as well as for those with some background in the computing field. It has been specifically designed for use in college courses on COBOL both in two
year and four-year schools.
OBJECTIVES OF THIS BOOK
1. To teach students how to design programs so that they are easy to read, debug, modify, and maintain.
2. To provide students with the ability to write well-designed elementary, intermediate, and advanced structured COBOL programs in their entirety. These include both batch and interactive programs.
3. To familiarize students with information processing and systems concepts that will help them interact with users and systems analysts when designing programs.
4. To focus on the key elements of the most recent COBOL standard, called COBOL 85, that facilitate and promote the writing of well-designed structured programs. We highlight where COBOL 85 features differ from COBOL 74, the previous standard. We also point to proposed changes likely to be incorporated in the next standard, which is currently referred to as COBOL 9x.
5. To familiarize students with programming tools such as pseudocode and hierarchy charts that make program logic more structured, modular, and top-down. We also provide information on the flowchart, which is an older tool, but one that is still used by some for planning purposes.
6. To teach students useful techniques for maintaining and modifying older ``legacy'' programs.
HOW THIS BOOK DIFFERS FROM STRUCTURED COBOL PROGRAMMING, SEVENTH EDITION
The eighth edition of Structured COBOL Programming builds on the strengths of the previous seven editions and includes some changes and additions we think have significantly improved the text. The dual emphasis on structured program design and syntax is retained, as is the focus on top-down modular programming and documentation. In this edition, we highlight pseudocode as the primary program planning tool.
The following are some of the specific changes we have made:
1. COBOL 85 program design elements are the focus of this text. Some more structured types of processing are available beginning with COBOL 85. Since there are still some COBOL 74 users of this text, we focus on COBOL 85 design elements, but where these differ from COBOL 74, we include those differences in the margins.
One main change that impacts most of the programs in the new edition relates to the method used for reading records. For COBOL 74 users, we explain the concepts of a priming READ, which remains one way of structuring programs. But for COBOL 85 users, we emphasize the following method for designing programs:
PERFORM UNTIL ARE-THERE-MORE-RECORDS = `NO '
READ INPUT-FILE
AT END
MOVE `NO ' TO ARE-THERE-MORE-RECORDS
NOT AT END
PERFORM 200-CALC-RTN
END-READ
END-PERFORM
Our COBOL 85 programs use the above structure and, in the margin, show the COBOL 74 structure that includes a priming READ.
We also focus on scope terminators using COBOL 85 and illlustrate their use extensively. The EVALUATE verb, in-line PERFORMs, and clauses such as NOT AT END and NOT INVALID KEY are emphasized throughout the text. Here, again, we do not abandon COBOL 74 but illustrate how it differs from COBOL 85.
COBOL 9x features that have already been approved for use in the new standard are explained in detail as well.
To facilitate the reader's understanding of these three standards, we use icons to highlight a feature that relates specifically to a particular standard.
2. Interactive and batch processing. We focus on batch processing through Chapter 4. Beginning in Chapter 5, we use the ACCEPT and DISPLAY verbs and explain the differences between batch and interactive processing. In Chapter 6, we introduce the SCREEN SECTION and illustrate how users can create fully interactive programs. From Chapter 6 on, every chapter includes interactive elements and at least one end- of-chapter Programming Assignment that requires interactive processing. Topics that specifically relate to interactive issues are highlighted with the use of an interactive icon.
3. A streamlined text. In many schools, COBOL courses are in
transition. Some are one-semester courses and others have a two-semester sequence. This book begins, in Chapter 1, by explaining the fact that a very large number of programs have been written in COBOL and continue to be written in COBOL, so that, despite the claims of some pundits, COBOL is not a dying language, but a language in transition.
We make the assumption that most programming courses in colleges and universities introduce students to the fundementals of the language and then provide them with enough information to learn advanced concepts on their own. Thus, we have streamlined the text by omitting some topics that are only infrequently covered in many courses. For example, double- and triple-level arrays are introduced in a chapter on arrays, but are not emphasized here. Relative file processing is introduced along with indexed file processing in a single chapter.
Because we realize that some instructors may wish to have additional coverage of more advanced topics, we provide supplements that can be downloaded from our Web site on the Internet.
We believe that the result is a new text, which includes appropriate coverage of all topics without being overpowering in either depth or breadth.
4. Pseudocode and Flowcharting. In this edition, we focus primarily on pseudocode. We introduce flowcharts and illustrate them in Chapter 5. After that, the planning tool we use predominantly is pseudocode. We believe that pseudocode is a more current planning tool, but for those who still prefer flowcharting, there is enough in this edition to help students plan programs with flowcharts.
5. The Internet. Our Web site is www.wiley.stern/cobol/. We use our Web site to provide late-breaking information to our readers on COBOL 9x and other aspects of COBOL. We also use the Web site to provide supplementary material that can be downloaded. This includes advanced topics, the COBOL Syntax Reference Guide, and other additions to the text. Finally, we use our Web site to link to other Web sites that include COBOL references. References in the text that point to Web sites include a Net icon.
6. Object-Oriented COBOL and other issues for the twenty-first century. We include a full chapter on object-oriented COBOL, with examples, which is expected to be part of the COBOL 9x standard. We also discuss COBOL issues that relate to the future. For example, the two-digit year that is commonly used in many existing COBOL programs becomes problematic for the next century. Two-digit years have traditionally assumed a year in the 1900s. How will we distinguish between 2084 and 1984? This issue, and others like it, are addressed in the text.
7. A focus on maintaining existing COBOL programs. Many students begin their programming careers as maintenance programmers. To date, little or no attention has been given in textbooks to the techniques used to modify and update existing legacy code. We include a Programming Assignment in each chapter that focuses on maintenance issues.
8. Record layouts. Rather than use the traditional pictorial record layout for describing input and output disk files, we describe our records using a format that has become a standard for depicting database records. You will see these new record layouts throughout the text.
9. Intrinsic functions. Intrinsic functions are now a part of the COBOL 85 extended standard. Many texts add them as a final chapter. We believe intrinsic functions are important enough to be integrated into the text. We introduce them in Chapter 7, along with arithmetic verbs, and use them throughout the book.
10. Debugging Tips have been enhanced. We continue to include an end-of- chapter series of Debugging Exercises that provide users with program code that needs corrections. We also highlight Debugging Tips in the text that help users avoid errors. The Debugging icon is used to point to these items.
11. Illustrated programs, Practice Programs, and Programming Assignments have been redesigned to reflect changes to the COBOL standard and to more appropriately depict real-world problems.
FEATURES OF THE TEXT
Format
The format of this text is designed to be as helpful as possible. Each
chapter begins with:
1. A detailed chapter outline.
Before beginning a chapter, you can get an overview of its contents by looking at this outline. In addition, after you have read the chapter, you can use the outline as a summary of the overall organization.
2. A list of objectives.
This list helps you see what the chapter is intended to teach even before you read it.The material is presented in a step-by-step manner with numerous examples and illustrations. Within each chapter there are self-tests, with solutions, that are designed to help you evaluate your own understanding of the material presented. We encourage you to take tests as you go along. They will help pinpoint and resolve any misunderstandings you may have.
End-of-Chapter Material
Each chapter ends with learning aids consisting of:
1. Chapter Summary.
2. Key Terms List. This is a list of all new terms defined in the chapter. Appendix E is a glossary that lists all key terms in the text along with their definitions.
3. Chapter Self-Test - with solutions so you can test yourself on your understanding of the chapter as a whole.
4. Practice Program. A full program is illustrated. We recommend you read the definition of the problem and try to code the program yourself. Then compare your solution to the one illustrated.
5. Review Questions. These are general questions that may be
assigned by your instructor for homework.
6. Debugging Exercises. These are program excerpts with errors in them. You are asked to correct the coding. The errors highlighted are those commonly made by students and entry-level programmers.
7. Programming Assignments. The assignments appear in increasing order of difficulty. They include a full set of specifications similar to those that programmers are actually given in the ``real world.'' You are asked to code and debug each program using test data. You will need to either create your own test data or receive a set from your instructor.
Programming Assignments in each chapter include at least one interactive program (designated with an icon) and a maintenance program that students will need to modify or update. Appendix B includes sample test data that can be used for Programming Assignment 2 in each chapter.
A syntax reference guide and a disk containing all programs illustrated in the book also accompany this text. The disk also contains data sets for all Programming Assignments. Alternatively, both the syntax reference guide and the disk can be downloaded from the Internet.
INSTRUCTIONAL AIDS
Two instructor's resource manuals are available. One contains (1) solutions to all text questions, (2) full examinations, and (3) course outlines. The second contains solutions to all Programming Assignments from the text. This latter manual is packaged with a disk that contains (1) test data for all Programming Assignments and (2) additional Debugging Exercises. A student data disk containing all programs illustrated in the book, along with data, is also provided. Instructors are free to distribute these disks to their students. The Data disk's contents can also be downloaded from the Internet.
A computerized test bank and set of transparency masters are also available.
An electronic multimedia slide presentation package, designed using PowerPoint, is available as a lecture enhancer or as a student study tool.
The educational version of Ryan McFarland's (RM) COBOL-85 is packaged with our manual called Getting Started with RM/COBOL-85, 2nd edition. Getting Started with Micro Focus Personal COBOL is also available with either of two versions of the Micro Focus compiler - Personal COBOL for DOS or Personal COBOL for Windows.
The Micro Focus compilers are distributed by John Wiley & Sons only to colleges universities in North America. To obtain these compilers outside of North America, please contact Micro Focus Publishing at mfpublg@camicrofocus.com or Micro Focus Publishing, 2465 East Bayshore Rd., Palo Alto, CA 94303 USA. For online help, an email address (techhelp@cawiley.com) is available for faculty only who may experience difficulty installing or using these compilers. If you are a student, please ask your instructor for help.
Wiley's Web site for this book is www.wiley.com/cobol/; it contains late- breaking information as well as supplements that can be downloaded, and linkages to other COBOL sites.
The reviewers who provided many helpful suggestions throughout the
development of this project are acknowledged on page [SP]s[SP]s[SP]s, along with all of those who helped bring this project to fruition.
We update our programming texts every few years and welcome your comments, criticisms, and suggestions. We can be reached c/o:
Nancy Stern
Robert A. Stern
BCIS Department
Hofstra University
Hempstead, NY 11550
You can also contact us using CompuServe's EasyPlex electronic mail service.
Our user id is 76505,1222.
Our Internet address is acsnns@hofstra.edu.
Nancy Stern
Robert Stern