Just like the evergreen, the COBOL programming language has remained vibrant and full of life year after year. Today, COBOL is running a large number of the world's business data applications, and it's likely to remain a viable language in the years ahead.
Now in its 11th Edition, Nancy Stern, Robert Stern, and James Ley's COBOL for the 21st Century continues to show how to design COBOL programs that are easy to read, debug, modify, and maintain. You'll learn to write interactive programs as well as batch programs with sophisticated file processing techniques, and become familiar with valuable information processing and systems concepts.
* Updated to reflect COBOL 2008, where appropriate.
* A chapter on the Report Writer Module.
* More end-of-chapter questions.
* A running case study builds on what you have learned in each chapter.
* Integrated coverage of interactive programming.
* Covers information processing and systems concepts that will help you interact with users and systems analysts when designing programs.
* Introduces programming tools such as pseudocode and hierarchy charts that make program logic more structured, modular, and top-down.
* Presents useful techniques for maintaining and modifying older "legacy" programs.
* Effective learning tools, including chapter outlines and objectives, debugging tips and exercises, critical-thinking questions, and programming assignments.
* Links to COBOL Internet resources.
* Companion Website (www.wiley.com/college/stern), featuring a syntax reference guide, data sets for all programming assignments, and all programs illustrated in the book.
Designed for beginners with no programming or computer experience, this revised textbook teaches structured programming concepts. Although primarily aimed at college students, it may appeal to programmers who maintain existing COBOL programs . It focuses on elements of the COBOL 85 standard. Topics include data validation, sequential file processing and OOP principles.
Dr. Nancy Stern received a B.A. in mathematics from Barnard College and an M.S. in mathematics and computer science from New York University. She earned an M.A. and a Ph.D. in the history of science and technology from the State University of New York at Stony Brook. Her Ph.D. thesis on the development of Eckert-Mauchly computers has been published by the Digital Equipment Corporation. Her research on the history of electronic digital computers has been supported by a grant from the National Science Foundation.
Dr. Stern has co-authored numerous textbooks in the computing field, including Computing in the Information Age, Structured COBOL Programming, Assembler Language Programming, Structured Flowcharting, System Analysis, Structured RPG III Programming, Turbo Basic, Microsoft Basic and The Impact of Computers on Society. She has also written many articles for ACM Computing Surveys, Datamation, Computerworld, the Annals of the History of Computing, The IEEE Spectrum, Technology and Culture and The Social Studies of Science, as well as a book on the history of computing called From ENIAC to UNIVAC. Her books have been translated into Spanish, Arabic, Portuguese, Korean and Chinese.
Chapter 1 : An Introduction to Structured Program Design in COBOL 5
Interactive vs. Batch Processing
Some applications are processed interactively, as the data is transacted, while other data is collected and processed later, in batches. Interactive applications typically accept data from a PC, workstation, or terminal. The input is processed immediately and the output is displayed on a screen and/or printed. This type of interactive processing is used when data must be current at all times and output is required immediately after processing. A Point-of-Sale system in which receipts are computer generated when sales are transacted is an example of an interactive application.
Other applications process large volumes of input at periodic intervals. Payroll procedures used to update the master collection of payroll information prior to printing pay checks are often performed in batch mode at periodic intervals. We will see that COBOL is ideally suited for both interactive and batch processing applications.
When an applications program is written for a specific user it is called a customized program. COBOL is ideally suited as a language for writing customized applications programs. Although we will focus on COBOL for applications programming in this text, we now provide a brief description of another type of applications software called an applications package.
If the tasks to be performed by a program are relatively standard, such as preparing a budget, an applications package might be purchased as an alternative to writing a customized program in a language such as COBOL. Such packages are sold by software vendors. Typically, documentation is provided by the manufacturer in the form of a user's manual, which explains how to use the package. For example, Lotus for Windows is a widely used package for applications such as budgeting, scheduling, and preparing trial balances.
If a package exists that can be used as is for an application, purchasing it will almost always be cheaper and easier than writing a customized program. But if an application has special requirements, then writing a customized program may be preferable to modifying an existing package.
MACHINE LANGUAGE PROGRAMS
All programs to be executed by the computer must be in machine language. It would be very tedious and cumbersome for the programmer or software developer to code instructions in this form. He or she would need to reference actual addresses or locations in memory and use complex instruction codes.
There are numerous symbolic programming languages that can be translated into machine language. COBOL is one such language that is used extensively for commercial applications. Other symbolic programming languages include Visual Basic, Pascal, and C+ +.
THE APPLICATIONS PROGRAM DEVELOPMENT PROCESS
The process of developing programs is similar for all applications regardless of the symbolic programming language used. An overview of the steps involved in the program development process follows. Each of these steps will then be discussed in detail.
PROGRAM DEVELOPMENT PROCESS
1. Determine Program Specifications Programmers, along with systems analysts who are responsible for the overall computerized design of business procedures, work with users to develop program specifications. Program specifications include input and output layouts describing the precise format of data along with the step-by-step processing requirements for converting input to output.
2. Design the Program Using Program Planning Tools Programmers use design or program planning tools such as flowcharts, pseudocode, and hierarchy charts to help map out the structure and logic of a program before the program is actually coded.
3. Code and Enter the Program The programmer writes and then keys or enters the source program into the computer system using a keyboard.
4. Compile the Program The programmer makes certain that the program has no rule violations.
5. Test the Program The programmer develops sample data and uses the program to operate on it to ensure that processing is correct.
6. Document the Program The programmer writes procedure manuals for users and computer operators so they can run the program on a regularly scheduled basis.
Most novices believe that computer programming begins with coding or writing program instructions and ends with program testing. You will find, however, that programmers who begin with the coding phase often produce poorly designed or inadequate programs. The steps involved in programming should be developmental, where coding is undertaken only after the program requirements have been fully specified and the logic to be used has been carefully planned.
Moreover, there are steps required after a program has been coded and tested. Each program must be documented with a formal set of procedures and instructions that specify how it is to be used. This documentation is meant for (1) those who will be working with the output, (2) computer operators who will run the program on a regularly scheduled basis, and (3) maintenance programmers who may need to make modifications to the program at a later date.
DETERMINE PROGRAM SPECIFICATIONS
When a company decides to computerize a business application or information system such as payroll or accounts receivable, a systems analyst or a software developer is typically assigned the task of designing the entire computerized application. This systems analyst works closely with users to determine such factors as output needs, how many programs are required, and input requirements. A user is the businessperson who, when the application is computerized, will depend on or use the output.
When a systems analyst decides what customized programs are required, he or she prepares program specifications to be given to the programmers or software developers so that they can perform their tasks. Typically, the program specifications consist of:
1. Record layout forms to describe the formats of the input and output data on disk or other storage medium. Figure 1.1 illustrates two examples of record layouts. (We will use version (b) for most of our illustrations.) They indicate:
2. Printer Spacing Charts for printed output. Printed output requires a format not typically needed for other types of output: