Structured COBOL Programming

Slides:



Advertisements
Similar presentations
Chapter 3: Modules, Hierarchy Charts, and Documentation
Advertisements

Programming Types of Testing.
Chapter 2 - Problem Solving
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 2 - Problem Solving
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)
Professor Michael J. Losacco CIS 1150 – Introduction to Computer Information Systems Programming and Languages Chapter 13.
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.
Chapter 9 Describing Process Specifications and Structured Decisions
Computers: Tools for an Information Age
Program Flow Charting How to tackle the beginning stage a program design.
Modules, Hierarchy Charts, and Documentation
Chapter 2: Developing a Program Extended and Concise Prelude to Programming Concepts and Design Copyright © 2003 Scott/Jones, Inc.. All rights reserved.
COBOL for the 21 st Century Stern, Stern, Ley Chapter 1 INTRODUCTION TO STRUCTURED PROGRAM DESIGN IN COBOL.
Chapter 1 Program Design
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 3 Planning Your Solution
PRE-PROGRAMMING PHASE
Programming. Software is made by programmers Computers need all kinds of software, from operating systems to applications People learn how to tell the.
Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 1 Introduction To Computers.
COBOL for the 21st Century
Structured COBOL Programming
1 L07SoftwareDevelopmentMethod.pptCMSC 104, Version 8/06 Software Development Method Topics l Software Development Life Cycle Reading l Section 1.4 – 1.5.
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
Chapter 2: Developing a Program Prelude to Programming Concepts and Design Copyright © 2001 Scott/Jones, Inc.. All rights reserved. 1 Chapter 2 Developing.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
Structured COBOL Programming, Stern & Stern, 9th edition
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)
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Developing a Program.
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)
Simple Program Design Third Edition A Step-by-Step Approach
สาขาวิชาเทคโนโลยี สารสนเทศ คณะเทคโนโลยีสารสนเทศ และการสื่อสาร.
Chapter To familiarize you with  Why COBOL is a popular business-oriented language.  Programming practices and techniques  History of COBOL.
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.
Designing and Debugging Batch and Interactive COBOL Programs Chapter 5.
Describe the Program Development Cycle. Program Development Cycle The program development cycle is a series of steps programmers use to build computer.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 1- 1 October 20, October 20, 2015October 20, 2015October 20,
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.
Lecture 1 Introduction Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
INTRODUCTION TO COMPUTING CHAPTER NO. 04. Programming Languages Program Algorithms and Pseudo Code Properties and Advantages of Algorithms Flowchart (Symbols.
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)
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
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.
CHAPTER 1 INTRODUCTION 1 st Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
CHAPTER 1 INTRODUCTION 1 st semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
5-1 Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout John.
1 Program Planning and Design Important stages before actual program is written.
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved.
The Hashemite University Computer Engineering Department
Chapter 2 - VB 2005 by Schneider- modified by S. Jane '081 Chapter 2 - Problem Solving 2.1 Program Development Cycle 2.2 Programming Tools.
Alexandria University Faculty of Science Computer Science Department Introduction to Programming C++
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
Evolution of C and C++ n C was developed by Dennis Ritchie at Bell Labs (early 1970s) as a systems programming language n C later evolved into a general-purpose.
INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
PROGRAMMING (1) LECTURE # 1 Programming and Languages: Telling the Computer What to Do.
Chapter 1 Introduction 2nd Semester H
Lecture 1 Introduction Richard Gesick.
CSCI-235 Micro-Computer Applications
Unit# 8: Introduction to Computer Programming
Designing and Debugging Batch and Interactive COBOL Programs
An Introduction to Structured Program Design in COBOL
Chapter 1 Introduction(1.1)
Programming.
Presentation transcript:

Structured COBOL Programming 10th edition John Wiley & Sons, Inc. Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout PowerPoint Winifred J. Rex Presentation Bowling Green State University

An Introduction to Structured Program Design in COBOL Chapter 1 An Introduction to Structured Program Design in COBOL Please note that the original slides will be modified in a number of places by your professor. These changes are for pedagogical reasons.

Chapter Objectives To familiarize you with Why COBOL is a popular business-oriented language. Programming practices and techniques History of COBOL Use of the current ANSI standard versions of COBOL Four divisions of a COBOL program

Chapter Contents Computer Programming: An Overview Applications Program Development Process Nature of COBOL History of COBOL and the ANS Versions Techniques for Improving Program Design Sample Programs Entering and Running a COBOL Program on Your Computer

Computer Program A set of instructions that enables computer to process data Also called software Two types of computer programs Operating system programs - control overall operations of computer Oftentimes called System Software Applications programs - perform tasks required by users Often called Applications Software  Us.

Applications Programs Written by applications programmer May provide quick solution to one-time problem Displaying average grade for set of exam scores Or may be run on regularly scheduled basis Program to print student transcripts each semester Program to generate a Payroll Program to generate and print an Inventory Listing

Application Programs - Customized Written for specific users like doctors, car dealerships Necessary if user has special requirements

Applications Package – General Usage Written for general user who needs program to perform standard tasks Standard tasks include budgeting, scheduling payroll, etc. Cheaper, easier than writing customized program

Program Languages Machine language Only language computer understands All programs executed on computer must be in machine language Machine language programs difficult to write Written in binary, such as: 0001101001010100 (actual instruction) 010110101000000011000100 (actual instruction in binary)

Assembler Languages Level ‘higher’ than Machine Language. Use mnemonic codes rather than pure binary digits, such as: L R5,X AR R5,R4 ST R5,SUM Each of these instructions translates (normally one-to-one) into a machine language statement (that is, binary…)

Program Languages Symbolic language (like COBOL) Called Higher-Level Languages English-like languages used to write programs Easier than writing programs in machine language or assembly languages. Must be translated or compiled into machine language to run on computer

Program Development Process Determine Program Specifications – the “Whats” Design Program Using Program Planning Tools – the “Hows.” Code and Enter Program (using some editor) Compile Program Implementation Test Program Document Program

1. Program Specifications Systems analysts, users and programmers develop specifications Specifications include: Description of input and output data Description of what the program must do to the input to convert it to the output - that is, WHAT the program is to do. They may provide formulas, constraints on data, conditions, etc. etc. BUT (again, not How the developers accomplish this!) In a perfect world, Systems Analysts specify the ‘requirements’ needed. (doesn’t always work this way.)

1. Program Specifications Record layout forms describe format of input and output data Data names of each data item in record Location of each data item in record Size of each data item Number of decimal positions (for numeric data items) Please note that exactly WHO does this may vary depending on the expertise of the systems analysts, developers, etc. But these are part of the Specifications.

1. Program Specifications Printer spacing charts describe Spacing of outputs (see pp 6-7) hard copy reports screen layouts, etc. Layout of printed output Heading, detail, total lines Error messages and locations…

2. Design the Program Program planning tools used to map out structure and logic of program Once specifications are captured (discuss!), design takes place. Two real kinds of design: Architectural design (high level, parts; components, blocks of functionality; relationships among these blocks, and Detail design – the logic inside each block, part, component, etc.

2. Design the Program Different tools may be used to capture the preliminary (architectural) design as well as the detail (logic; algorithms) design. Architectural Design: For many traditional systems, we may use Data Flow Diagrams; Structure Charts, System Flow Charts, and similar technologies For Detail design: Most practitioners use flowcharts, pseudocode, HIPO, or other techniques to capture the module logic.

Book cites for Detail Design: Architectural design: Book suggests Hierarchy charts show relationships among sections of program. We will use these and call them Structure Charts. Book cites for Detail Design: Flowcharts use block diagrams to represent logic – a graphical model, and Pseudo-code uses English-like statements This one is preferred but some hang on to the flowchart. In some cases, it ‘is’ clearer, though.

3. Code and Enter Program Programmer writes and enters program into computer Program written in symbolic language (like COBOL) Called source program

4. Compile Source Program Compiler is program that Checks source program for rule violations Translates source program into object program (See p. 8 for System Flow Chart. Know this.) Source program in symbolic language Translated by compiler Object program in machine language

5. Test Program Test or debug program to ensure it contains no errors Check for two types of errors Compile-Time Errors Execution Errors

Compile-Time Errors Errors detected by compiler during translation from COBOL to machine language Detects violations of programming rules Misspelled reserved words Missing punctuation Errors in use of the programming language Also called syntax errors

Execution Errors Detected when program is run Logic error causes incorrect output Sequence of instructions incorrect Wrong instruction coded Run-time error if computer cannot execute instruction Attempt to divide by zero Attempt to read a file that cannot be found

Debugging Techniques Desk checking Correcting syntax errors always do this. Can be costly to omit. Correcting syntax errors Correct syntax errors and resubmit Program walkthroughs Sometimes done in teams; good approach Can be done prior to submitting for compilation. Executing the program  Just because a program runs to EOJ, does NOT mean that program was successful!!

6. Document the Program Documentation - formal set of procedures and instructions to specify how to use program Written for Those working with output Computer operators who run program Maintenance programmers who make modifications to program In some circles called: program maintenance manual, operators manual, users manual, etc…

Nature of COBOL Business-oriented language Standard language Great for business data processing Large volumes of data Great for data manipulation No language is better for transaction processing or data manipulation than COBOL Has other major deficiencies, but not these. Standard language English-like language Multiply hours-worked by rate giving salary Relatively easy to understand

History of COBOL Developed in 1959 as standard language to meet needs of business Committee to develop language convened by Department of Defense Included representatives from academia, business, computer manufacturers

Standard Versions of COBOL 1968 1974 1985 wide variations in COBOL compilers first COBOL standard set by American National Standards Institute (ANSI) second ANSI standard to make COBOL more efficient, standardized this ANSI standard incorporated structured programming techniques

Current and Future Standards  1985 currently the most widely used Sometimes called COBOL 2. 2002+ is next standard Approval expected in 2002 Information on 2002+ COBOL standard at http://www.ansi.org

Future of COBOL Likely to remain important language Unlike academic environment, most programs are developed to be used for many years to realize a ROI. This implies the need to maintenance as requirements change and errors are discovered. Older COBOL programs need to be updated Still used by many for new program development

Use of COBOL About 200 billion lines of COBOL source code in use 5 billion new lines added each year Used by 42.7% of application programmers in medium to large U.S. companies $200 million in expected revenues for 2001

Year 2000 Problem (Y2K) Year stored as two digits in older programs to save space 19 assumed as valid prefix for all years 95 represented year 1995 Invalid as prefix for years 2000 and beyond 00 could mean 1900 or 2000

Year 2000 Problem (Y2K) Many calculations with dates incorrect starting in 2000 To find your age if you were born in 1970 Subtract 70 from 95 (95 - 70 = 25) Calculation incorrect for year 2000 and beyond 00 - 70 = -70 when age should be 30

Year 2000 Problem (Y2K) To correct problem Billions of lines of code, many written in COBOL needed to be examined Code changed to use four digits for year Age, other calculations now correct 1995 - 1970 = 25 2000 - 1970 = 30

Improving Program Design Two techniques used to develop programs that are easier to understand, test, debug and modify Structured Programming Top-Down Programming

Structured Programming Eliminates use of GO TO statements Allowed skipping to different sections of program without returning to starting point Advocated the use of simple program constructs: sequence selection iteration plus two extensions (later) Program logic easier to follow with "GO-TO-less" programming

Structured Programming Program divided into paragraphs Main paragraph or module controls logic flow using PERFORM statements Sometime called a ‘driver’ module… Main module "performs" other modules when instructions in that module required Control transferred to a different paragraph and, upon completion of the instructions in that paragraph, control returns to the main paragraph. Each module can be written and tested independently of others

Top-Down Programming Another technique to make programs easier to understand, test, debug and modify Develop program like term paper Develop outline first Add details for each of main steps Add further refinement for more complex steps

Top-Down Programming For COBOL program Code main modules or routines first Code intermediate modules next Details deferred to minor modules and coded last We will use this technique a lot later on. We may refer to this technique as ‘drivers’ and ‘stubs.’ This is an outstanding approach to developing larger programs…