Designing and Debugging Batch and Interactive COBOL Programs Chapter 5.

Slides:



Advertisements
Similar presentations
Chapter 2 - Problem Solving
Advertisements

Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 2 - Problem Solving
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)
Program Flow Charting How to tackle the beginning stage a program design.
Program Development and Programming Languages
Chapter 2: Developing a Program Extended and Concise Prelude to Programming Concepts and Design Copyright © 2003 Scott/Jones, Inc.. All rights reserved.
Programming Fundamentals (750113) Ch1. Problem Solving
COBOL for the 21 st Century Stern, Stern, Ley Chapter 1 INTRODUCTION TO STRUCTURED PROGRAM DESIGN IN COBOL.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
McGraw-Hill Technology Education © 2006 by the McGraw-Hill Companies, Inc. All rights reserved CHAPTER PROGRAMMING AND LANGUAGES.
1414 CHAPTER PROGRAMMING AND LANGUAGES. © 2005 The McGraw-Hill Companies, Inc. All Rights Reserved Competencies Describe the six steps of programming.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 3 Planning Your Solution
PRE-PROGRAMMING PHASE
Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 1 Introduction To Computers.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
COBOL for the 21st Century
Structured COBOL Programming
Chapter 2: Developing a Program Prelude to Programming Concepts and Design Copyright © 2001 Scott/Jones, Inc.. All rights reserved. 1 Chapter 2 Developing.
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)
CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Developing a Program.
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)
1 Chapter 4. To familiarize you with methods used to 1. Access input and output files 2. Read data from an input file 3. Perform simple move operations.
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)
PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert.
PROGRAMMING LANGUAGES Prof. Lani Cantonjos. PROGRAM - set of step-by-step instructions that tells or directs the computer what to do. PROGRAMMING LANGUAGE.
Programming Concepts Chapter 3.
Describe the Program Development Cycle. Program Development Cycle The program development cycle is a series of steps programmers use to build computer.
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
IXA 1234 : C++ PROGRAMMING CHAPTER 1. PROGRAMMING LANGUAGE Programming language is a computer program that can solve certain problem / task Keyword: Computer.
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)
Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout.
Definition of Terms Software/Programs Programs that directs the operation of a computer system Set of instructions Codes Programming Process of planning,
Dale Roberts 1 Program Control - Algorithms Department of Computer and Information Science, School of Science, IUPUI CSCI N305.
5-1 Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout John.
The basics of the programming process The development of programming languages to improve software development Programming languages that the average user.
1 Program Planning and Design Important stages before actual program is written.
1 Chapter 9. To familiarize you with  Simple PERFORM  How PERFORM statements are used for iteration  Options available with PERFORM 2.
PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert.
How to Program? -- Part 1 Part 1: Problem Solving –Analyze a problem –Decide what steps need to be taken to solve it. –Take into consideration any special.
Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved.
How Are Computers Programmed? CPS120: Introduction to Computer Science Lecture 5.
Chapter 2 - VB 2005 by Schneider- modified by S. Jane '081 Chapter 2 - Problem Solving 2.1 Program Development Cycle 2.2 Programming Tools.
Problem-solving with Computers. 2Outline  Computer System  5 Steps for producing a computer program  Structured program and programming  3 types of.
Alexandria University Faculty of Science Computer Science Department Introduction to Programming C++
PROGRAMMING. Computer Programs  A series of instructions to the computer  pre-written/packaged/off-the-shelf, or  custom made  There are 6 steps to.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
 Problem Analysis  Coding  Debugging  Testing.
Computer Programming - Key Concepts and Terms Computer Program – A computer program is a set of instructions for computer, arranged in logical order, using.
5.01 Understand Different Types of Programming Errors
Programming Languages
Chapter 2- Visual Basic Schneider
5.01 Understand Different Types of Programming Errors
Designing and Debugging Batch and Interactive COBOL Programs
Problem Solving Techniques
An Introduction to Structured Program Design in COBOL
Iteration: Beyond the Basic PERFORM
Iteration: Beyond the Basic PERFORM
Chapter 2- Visual Basic Schneider
Chapter 2- Visual Basic Schneider
PROGRAMMING FUNDAMENTALS Lecture # 03. Programming Language A Programming language used to write computer programs. Its mean of communication between.
ICT Gaming Lesson 2.
Presentation transcript:

Designing and Debugging Batch and Interactive COBOL Programs Chapter 5

Designing Before Coding Design program first –So program will work efficiently –So program works as integrated whole –Design techniques applicable to all languages Code program only after design done –Use syntax rules of language –Syntax rules are language-specific

Program Design Tool Hierarchy Charts Pseudo Codes Flowcharts

Hierarchy Charts To illustrate top-down relationships among modules Graphic method to divide program into modules Modules shown as rectangular boxes Relationships among modules represented by connected lines

Example of Hierarchy Chart

Pseudocode Primary tool for planning program logic Specifies instructions and logical control structures used by program Use one or more lines of pseudocode to describe each program step

Pseudocode and Hierarchy Charts Pseudocode shows actual sequence of instructions Hierarchy charts show relationships among modules Both help programmers –Develop efficient programs –Debug and modify programs

Four Logical Control Structures Used by structured programs to specify order in which instructions are executed 1.Sequence 2.Selection 3.Iteration 4.Case Structure

Sequence Instructions executed in order they appear Three instructions below executed one after the other START Read Amt1, Amt2 Compute Total = Amt1 + Amt2 Write Total STOP

Selection Instructions executed depending on existence of a condition Called IF-THEN-ELSE logical control structure

Selection Structure Pseudocode IF condition THEN instructions to do if condition exists ELSE instructions to do if condition doesn’t exist END-IF Example IF X is Less Than Y THEN Add X To Y ELSE Subtract X From Y END-IF

Iteration To specify repeated execution of series of steps Use in-line or standard PERFORM UNTIL for iteration in COBOL Both execute group of instructions repeatedly until a condition is met

Iteration Pseudocode In-line PERFORM UNTIL PERFORM UNTIL condition.. statements to be repeated. END-PERFORM.. Statements following PERFORM.

Iteration Pseudocode Standard PERFORM UNTIL PERFORM paragraph-1 UNTIL condition.. Statements following PERFORM. Paragraph-1... statements to be repeated.

Infinite Loops In-line and standard PERFORM UNTIL both repeat instructions until condition met If condition never met, loop never ends Causes error called an infinite loop

Infinite Loops Make sure loop ends by including instruction in loop that causes condition to be met For example, if condition is WS-MORE-DATA = ‘NO’ Make sure there is statement in loop that sets WS-MORE-DATA to ‘NO’ when there is no more data

Case Structure To choose from one of several sets of instructions depending on a condition For example, assume –Different instructions should be executed when field Code-In has values of 1, 2 or 3 –Any other value of Code-In is considered an error

Case Structure Pseudocode EVALUTATE Code-In WHEN 1 PERFORM paragraph-1 WHEN 2 PERFORM paragraph-2 WHEN 3 PERFORM paragraph-3 WHEN OTHER PERFORM error-paragraph END-EVALUATE

Case Structure Pseudocode Depending on the value of Code-In, the instructions in one of the paragraphs will be executed

Syntax Errors Compiler translates your COBOL code into machine language Checks for rule violations or syntax errors while translating –For example, misspelling a reserved word Must be corrected before program can be executed

Identifying syntax errors Error may be caused by line above one indicated by compiler One error may generate multiple error messages Severe errors may prevent entire sections from compiling –When error fixed, even more errors appear because more of program checked

Logic errors Detected during execution of program May be due to –Coding order of instructions incorrectly –Coding incorrect instruction for desired result

Detecting Logic Errors in Output Prepare complete test data Include test data values –That meet each condition –That do not meet conditions Perform structured walkthrough –Determine what results should be produced Run program Compare computer-produced results to expected results

Debugging Process of eliminating both syntax and logic errors from program Syntax errors detected by compiler during compilation Logic errors not detected until program executed