PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert.

Slides:



Advertisements
Similar presentations
The Future of COBOL A Focus on Interactive Programming Appendix C Stern & Stern.
Advertisements

Chapter 15 Creating Database Forms and Reports Introduction Forms Reports.
7-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
5-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
© Copyright 2011 John Wiley & Sons, Inc.
© Copyright 2011 John Wiley & Sons, Inc.
COBOL for the 21 st Century Stern, Stern, Ley Chapter 1 INTRODUCTION TO STRUCTURED PROGRAM DESIGN IN COBOL.
Chapter 1 Program Design
Chapter 3 Planning Your Solution
COBOL for the 21st Century
Accounting Information Systems, 1st Edition
Structured COBOL Programming
PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert.
Systems Analysis and Design
Systems Analysis and Design
Systems Analysis and Design
15-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
PowerPoint Presentation for Dennis, Wixom, & Roth Systems Analysis and Design, 3rd Edition Copyright 2006 © John Wiley & Sons, Inc. All rights reserved..
Structured COBOL Programming, Stern & Stern, 9th Edition PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured.
Structured COBOL Programming, Stern & Stern, 9th edition
4-1 Coding Complete COBOL Programs: The PROCEDURE DIVISION Chapter 4.
4-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
10-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
4-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
2-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
Chapter To familiarize you with  Why COBOL is a popular business-oriented language.  Programming practices and techniques  History of COBOL.
Structured COBOL Programming
1-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
Slide 1 UML Review Chapter 2: Introduction to Object-Oriented Systems Analysis and Design with the Unified Modeling Language, Version 2.0 Alan Dennis,
PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert.
Designing and Debugging Batch and Interactive COBOL Programs Chapter 5.
© Copyright 2011 John Wiley & Sons, Inc.
3-1 The DATA DIVISION Chapter Chapter Objectives To familiarize you with Systems design considerations Ways in which data is organized Rules for.
Slide 1 Systems Analysis and Design with UML Version 2.0, Second Edition Alan Dennis, Barbara Wixom, and David Tegarden Chapter 8: Behavioral Modeling.
PowerPoint Presentation for Dennis & Haley Wixom, Systems Analysis and Design, 2 nd Edition Copyright 2003 © John Wiley & Sons, Inc. All rights reserved.
PowerPoint Presentation for Dennis, Wixom, & Roth Systems Analysis and Design, 3rd Edition Copyright 2006 © John Wiley & Sons, Inc. All rights reserved.
13-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
9-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
9-1 Iteration: Beyond the Basic PERFORM Chapter 9.
Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout.
PowerPoint Presentation for Dennis & Haley Wixom, Systems Analysis and Design, 2 nd Edition Copyright 2003 © John Wiley & Sons, Inc. All rights reserved.
Slide 1-1 Chapter 1 Terms Information Systems Overview Introduction to Information Systems Judith C. Simon.
Slide 1 Systems Analysis and Design with UML Version 2.0, Second Edition Alan Dennis, Barbara Wixom, and David Tegarden Chapter 8: Behavioral Modeling.
Slide 1-1 Chapter 1 Information Systems Overview Introduction to Information Systems Judith C. Simon.
Slide 1 Systems Analysis and Design With UML 2.0 An Object-Oriented Approach, Second Edition Chapter 2: Introduction to Object-Oriented Systems Analysis.
Slide 5-1 Chapter 5 Terms Applications Software for Business Introduction to Information Systems Judith C. Simon.
5-1 Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout John.
7-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
Structured COBOL Programming, Stern & Stern, 9th Edition CHAPTER 2 Cobol Language Fundamentals.
PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert.
2-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert.
Slide 1 Systems Analysis and Design With UML 2.0 An Object-Oriented Approach, Second Edition Chapter 2: Introduction to Object-Oriented Systems Analysis.
Slide 1 Systems Analysis and Design With UML 2.0 An Object-Oriented Approach, Second Edition Chapter 2: Introduction to Object-Oriented Systems Analysis.
COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
Slide 6-1 Chapter 6 System Software Considerations Introduction to Information Systems Judith C. Simon.
Slide 8-1 Chapter 8 Terms Programming Languages Introduction to Information Systems Judith C. Simon.
Alexandria University Faculty of Science Computer Science Department Introduction to Programming C++
Slide 1 Systems Analysis and Design with UML Version 2.0, Second Edition Alan Dennis, Barbara Wixom, and David Tegarden Chapter 8: Behavioral Modeling.
Introduction to Information Technology, 2 nd Edition Turban, Rainer & Potter © 2003 John Wiley & Sons, Inc 2-1 Introduction to Information Technology 2.
Slide 1 Systems Analysis and Design with UML Version 2.0, Second Edition Alan Dennis, Barbara Wixom, and David Tegarden Chapter 6: Functional Modeling.
Slide 6-1 Chapter 6 Terms System Software Considerations Introduction to Information Systems Judith C. Simon.
Roberta Roth, Alan Dennis, and Barbara Haley Wixom
CSCI-235 Micro-Computer Applications
Systems Analysis and Design With UML 2
Systems Analysis and Design
Designing and Debugging Batch and Interactive COBOL Programs
An Introduction to Structured Program Design in COBOL
Structured COBOL Programming
Chapter 1 Introduction(1.1)
Presentation transcript:

PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College 2000 John Wiley & Sons, In. All rights reserved. Reproduction or translation of this work beyond that permitted in Section 117 of 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, 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 damages, caused by the use of these programs or from the use of the information contained herein.”

Structured COBOL Programming, Stern & Stern, 9th edition Chapter 1 INTRODUCTION TO STRUCTURED PROGRAM DESIGN IN COBOL

Structured COBOL Programming, Stern & Stern, 9th edition CHAPTER 1 OBJECTIVES To familiarize you with: 1. The reasons for COBOL’s popularity as a business-oriented language. 2. Some general programming practices and techniques. 3. A history of COBOL’s evolution and its current ANS version. 4. An overview of the four divisions of a COBOL program.

Structured COBOL Programming, Stern & Stern, 9th edition CONTENTS COMPUTER PROGRAMMING: AN OVERVIEW –Types of Computer Programs – Applications Programs – Machine Language Programs – Symbolic Programs COMPUTER PROGRAMMING: AN OVERVIEW –Types of Computer Programs – Applications Programs

Structured COBOL Programming, Stern & Stern, 9th edition CONTENTS – Machine Language Programs – Symbolic Programs THE APPLICATIONS PROGRAM DEVELOPMENT PROCESS –Determine Program Specifications –Design the Program Using Program Planning Tools –Code and Enter the Program –Compile the Source Program –Test the Program –Document the Program

Structured COBOL Programming, Stern & Stern, 9th edition CONTENTS THE NATURE OF COBOL –COBOL Is a Business-Oriented Language –COBOL Is a Standard Language –COBOL Is an English-like Language –COBOL Is a User-friendly Language A HISTORY OF COBOL AND THE ANS VERSIONS –When it Began –The American National Standards (ANS) Versions of COBOL

Structured COBOL Programming, Stern & Stern, 9th edition CONTENTS –The Future of COBOL and the Year 2000 Problem TECHNIQUES FOR IMPROVING PROGRAM DESIGN –Structured Programming Using Modular Design for Coding Paragraphs –The Top-Down for Approach Coding Modules ENTERING & RUNNING A COBOL PROGRAM ON YOUR COMPUTER –Mainframe –Minicomputer –PC COBOL

Structured COBOL Programming, Stern & Stern, 9th edition COMPUTER PROGRAMMING: AN OVERVIEW

Structured COBOL Programming, Stern & Stern, 9th edition Types of Computer Programs A program is a set of instructions that enable a computer to process data. Software is the term used to describe all types of programs. An application program converts input data to output information.

Structured COBOL Programming, Stern & Stern, 9th edition Two types of computer programs: 1. Operating Systems Programs – Control the overall operations of the computer 2. Applications Programs –Written by Programmers or Software Developers –Programs that perform tasks required by users

Structured COBOL Programming, Stern & Stern, 9th edition Types of Computer Programs COBOL is one of the many languages used to write customized applications programs.

Structured COBOL Programming, Stern & Stern, 9th edition Applications Programs Interactive vs. Batch Processing Interactive applications typically accept input data from a PC, workstation, or terminal. Batch Processing applications process large volumes of input at periodic intervals.

Structured COBOL Programming, Stern & Stern, 9th edition Applications Programs Applications programs that are written for a specific user are called customized programs. Programs that are relatively standard are application packages that might be purchased.

Structured COBOL Programming, Stern & Stern, 9th edition All programs executed by the computer must be in machine language. Machine Language Programs

Structured COBOL Programming, Stern & Stern, 9th edition Symbolic Programs Symbolic Programs use English-like or symbolic instructions. –These programs must be translated or compiled into machine language. –COBOL is a symbolic programming language used for commercial applications.

THE APPLICATIONS PROGRAM DEVELOPMENT PROCESS

Structured COBOL Programming, Stern & Stern, 9th edition PROGRAM DEVELOPMENT PROCESS 1. Determine Program Specifications –Program Specifications consist of the following: Record layout forms to describe the input and output Printer spacing charts for printed output

Structured COBOL Programming, Stern & Stern, 9th edition PROGRAM DEVELOPMENT PROCESS 2. Design the Program Using Program Planning Tools using Common Tools: –Flowcharts A block diagram providing a pictorial representation of the logic to be used in a program –Pseudocode English-like expressions to depict the logic of the program –Hierarchy Charts Charts showing relationships among sections in a program

Structured COBOL Programming, Stern & Stern, 9th edition PROGRAM DEVELOPMENT PROCESS 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 COBOL compiler checks the source code to insure there are no rule violations. –A syntax error is a type of error that is found if a programming rule is violated.

Structured COBOL Programming, Stern & Stern, 9th edition PROGRAM DEVELOPMENT PROCESS 5. Test the Program –Programs are tested or debugged to ensure they have no errors. –A logic error is a type of error that the programmer may find only when the program is tested with sample or test data. 6. Document the Program –Procedure manuals for users and computer operators, called documentation, is prepared for use by the operating staff for regular production.

Structured COBOL Programming, Stern & Stern, 9th edition PROGRAM DEVELOPMENT PROCESS Remember, coding is undertaken only after the program requirements have been fully specified and the logic has been carefully planned.

Structured COBOL Programming, Stern & Stern, 9th edition DEBUGGING TECHNIQUES Desk Checking – Reviewing the program before and after keying Correcting Syntax Errors –Using the printed source list of the diagnostic messages to find and correct the errors

Structured COBOL Programming, Stern & Stern, 9th edition DEBUGGING TECHNIQUES Program Walkthroughs –Manually stepping through the program with test data. Detecting Logic Errors by Executing the Program –Often the most difficult part of debugging. –The preparation of test data is an extremely critical aspect of debugging.

Structured COBOL Programming, Stern & Stern, 9th edition THE NATURE OF COBOL COBOL is a Business-Oriented Language –COBOL, is one of the most widespread commercial applications languages in use today. –COBOL is an abbreviation for CO mmon B usiness O riented L anguage, COBOL is a Standard Language –COBOL is a common programming language available on most computers.

Structured COBOL Programming, Stern & Stern, 9th edition THE NATURE OF COBOL COBOL is an English-like Language –All instructions can be coded using English words. –The rules conform to many rules for writing in English COBOL is a User-Friendly Language –Because users are able to understand the English-like instructions it is considered a user-friendly language.

Structured COBOL Programming, Stern & Stern, 9th edition A HISTORY OF COBOL AND THE ANS VERSIONS

Structured COBOL Programming, Stern & Stern, 9th edition WHEN IT BEGAN Developed in 1959 by the CODASYL Committee. –A committee consisting of representatives members from academia, user groups, and computer manufacturers. Developed as a standard business- oriented language for which all major manufacturers would provide compilers. ANS established the first standards version in 1968.

Structured COBOL Programming, Stern & Stern, 9th edition WEB SITE The Internet site includes COBOL updates

Structured COBOL Programming, Stern & Stern, 9th edition THE FUTURE OF COBOL COBOL is likely to remain an important language in the years ahead for two reasons: 1. Older, mainframe-based “legacy” systems will need to be maintained by maintenance programmers who know COBOL. 2. COBOL is still being used by many organizations for new application development.

Structured COBOL Programming, Stern & Stern, 9th edition The Year 2000 Problem: the Y2K “Millenium Bug” Traditional two-digit coded dates will not work for the year Billions of lines of code will need to be changed. Y2K adjustment coding will increase the need for COBOL programmers –An estimated $600 billion, or more, dollars will be invested to fix this problem.

Structured COBOL Programming, Stern & Stern, 9th edition QUESTIONS?!

Structured COBOL Programming, Stern & Stern, 9th edition SELF-TEST QUESTIONS 1. A program must be in _________ language to be executed or run. Solution: machine

Structured COBOL Programming, Stern & Stern, 9th edition SELF-TEST QUESTIONS 2. Programs are typically written in a _______ language rather than in machine language because __________. Solution: symbolic; machine languages are very complex

Structured COBOL Programming, Stern & Stern, 9th edition SELF-TEST QUESTIONS 3. Programs written in a language other than machine language must be _______ before execution can occur. Solution: translated or compiled

Structured COBOL Programming, Stern & Stern, 9th edition SELF-TEST QUESTIONS 4. The process of converting a source program into machine language is called ___________. Solution: compilation or translation

Structured COBOL Programming, Stern & Stern, 9th edition SELF-TEST QUESTIONS 5. The program written in a programming language such as COBOL is called the ________ program. Solution: source or applications

Structured COBOL Programming, Stern & Stern, 9th edition SELF-TEST QUESTIONS 6. The object program is the _______. Solution: set of instructions that has been converted into machine language

Structured COBOL Programming, Stern & Stern, 9th edition SELF-TEST QUESTIONS 7. A ______ converts a source program into a(n)_____ program. Solution: compiler or translator program: object or machine language

Structured COBOL Programming, Stern & Stern, 9th edition SELF-TEST QUESTIONS 8. The errors that are detected during compilation denote ______; they are usually referred to as ________ errors. Solution: any violation of programming rules in the use of the symbolic programming language; syntax

Structured COBOL Programming, Stern & Stern, 9th edition SELF-TEST QUESTIONS 9. Before executing a program with test data, the logic of the program can be checked manually using a technique called a ____________. Solution: program walkthrough

Structured COBOL Programming, Stern & Stern, 9th edition SELF-TEST QUESTIONS 10. COBOL is an abbreviation for _________. Solution: Common Business Oriented Language

Structured COBOL Programming, Stern & Stern, 9th edition SELF-TEST QUESTIONS 11. COBOL is a common language in the sense that ______. Solution: it can be used on many computers

Structured COBOL Programming, Stern & Stern, 9th edition SELF-TEST QUESTIONS 12. (T or F) COBOL is ideally suited for scientific as well as business problems. Solution: F--it is ideally suited for business applications

Structured COBOL Programming, Stern & Stern, 9th edition SELF-TEST QUESTIONS 13. Y2K is an abbreviation for the __________ Problem. Solution: the Year 2000

Structured COBOL Programming, Stern & Stern, 9th edition SELF-TEST QUESTIONS 14. True or False In recent years, more COBOL programmers have been hired to help resolve the Millenium bug. Solution: True

Structured COBOL Programming, Stern & Stern, 9th edition SELF-TEST QUESTIONS 15. True or False The Y2K Problem has occurred because older programs used two- digit year codes rather than four- digit year codes in order to save space on files (e.g., 98 was used for 1998). Solution: True

Structured COBOL Programming, Stern & Stern, 9th edition TECHNIQUES FOR IMPROVING PROGRAM DESIGN

Structured COBOL Programming, Stern & Stern, 9th edition Structured Programming Using Modular Design for Coding Paragraphs The most important technique for improving the design of a program in any language is called structured programming. Structured Programming is a technique using logical control constructs that make programs easier to read, debug, and modify if changes are required.

Structured COBOL Programming, Stern & Stern, 9th edition Structured Programming Using Modular Design for Coding Paragraphs Structured programming is often called GO-TO-less programming since programmatic branches do not use GO TO statements. In COBOL this means writing programs using PERFORM statements

Structured COBOL Programming, Stern & Stern, 9th edition Structured Programming Using Modular Design for Coding Paragraphs The typical structured program is divided into paragraphs or modules, where a main module calls in other modules as needed. –Each module can be tested independently. Paragraph, routine, module are used interchangeably

Structured COBOL Programming, Stern & Stern, 9th edition The Top-Down Approach for Coding Modules Proper design is best achieved by developing major modules before minor ones. Main routines are coded first and are followed by intermediate routines and then minor ones.

Structured COBOL Programming, Stern & Stern, 9th edition The Top-Down Approach Coding using the top-down manner gives the primary attention to the origination of the program. Details are deferred or saved for minor modules, which are coded last.

Structured COBOL Programming, Stern & Stern, 9th edition A BRIEF OVERVIEW OF PROGRAM PLANNING TOOLS

Structured COBOL Programming, Stern & Stern, 9th edition GENERAL RULES FOR FLOW CHARTS 1. Each flowchart symbol denotes a specific operation. 2. Each symbol contains a note describing a particular function. 3. Flowcharts are read top to bottom.

Structured COBOL Programming, Stern & Stern, 9th edition RULES FOR INTERPRETING PSEUDOCODE 1. A pseudocode begins with a START and ends with a STOP. 2. All instructions are read in sequence. 3. The instructions between the: PERFORM...END-PERFORM are executed repeatedly UNTIL there are no more records to process.

Structured COBOL Programming, Stern & Stern, 9th edition 100-MAIN MODULE WAGE ROUTINE HIERARCHY OR STRUCTURE CHART Structure charts illustrate the logic flow in a program. –The following chart shows the relationships among modules in a program:

Structured COBOL Programming, Stern & Stern, 9th edition CHAPTER SLIDES END HERE CHAPTER SUMMARY COMES NEXT

Structured COBOL Programming, Stern & Stern, 9th edition CHAPTER SUMMARY A. The Nature of COBOL 1. It is the most widespread commercial programming language in use today. 2. COBOL is the abbreviation for Common Business Oriented Language. 3. It is an English-like language. 4. The American National Standards (ANS) versions of COBOL are 1968, 1974, and COBOL is expected.

Structured COBOL Programming, Stern & Stern, 9th edition SUMMARY B. Program Preparation and Debugging 1. Get program specifications from the analyst or prepare them yourself. 2. Use planning tools--flowcharts, pseudocode, hierarchy charts--for program design. 3. Compile the program and fix syntax errors. 4. Code the program. 5. Test the program using debugging techniques. 6. Document the program.

Structured COBOL Programming, Stern & Stern, 9th edition SUMMARY C. Techniques for Improving Program Design 1. Structured Programming a. Referred to as GO-TO-less programming b. Structured programs are subdivided into modules or paragraphs. 2. Top-Down Programming a. Major modules are coded before minor ones. B. Similar to developing an outline before writing a report.

Structured COBOL Programming, Stern & Stern, 9th edition SUMMARY D. The COBOL Divisions Identification Division a. Identifies the program to the computer system. b. May provide some documentation as well. c. PROGRAM-ID is the only required entry. Environment Division –Assigns a file-name to each file used. –Specifies the device that the file will use.

Structured COBOL Programming, Stern & Stern, 9th edition SUMMARY Data Division a. Defines & describes all input, output & work area b. File-Section (1) Each file-name is described in an FD. (2) Each record format within every file is an 01 entry. (3) Record fields are described with a PICTURE clause that specifies the size & type. c. Working-Storage Section (1) Defines work areas (2) An end-of-file indicator is coded here.

Structured COBOL Programming, Stern & Stern, 9th edition SUMMARY COBOL DIVISIONS Procedure Division a. Subdivided into paragraphs or modules. b. Includes all instructions to process input and produce output. c. All instructions are executed sequence. PERFORM...UNTIL... END-PERFORM is a loop.

Structured COBOL Programming, Stern & Stern, 9th edition SUMMARY d. Main-module entries: –The following are typical entries in a main module: (1) Files are either INPUT or OUTPUT and activated in an OPEN statement. (2) A PERFORM...END-PERFORM is a loop that is executed until there are no more records.

Structured COBOL Programming, Stern & Stern, 9th edition SUMMARY Main-module entries (continued): (3) Within the PERFORM we code a READ...AT END...NOT AT END… END-READ. (4) A CLOSE statement deactivates all files. (5) STOP RUN ends processing.

Structured COBOL Programming, Stern & Stern, 9th edition SUMMARY e. Calculation or processing paragraphs (1) These paragraphs are executed when a statement in the main module specifies a PERFORM paragraph name. (2) These paragraphs are required to process each input record.