Introductory Remarks. COURSE OBJECTIVES: (TAKEN FROM PREFACE) 1. To teach students how to design programs so that they are easy to read, debug, adapt,

Slides:



Advertisements
Similar presentations
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Advertisements

Lecture 1: Overview of Computers & Programming
Computer Programming Rattapoom Waranusast Department of Electrical and Computer Engineering Faculty of Engineering, Naresuan University.
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming The software development method algorithms.
Programming System development life cycle Life cycle of a program
Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Introduction to Computers and Programming. Some definitions Algorithm: –A procedure for solving a problem –A sequence of discrete steps that defines such.
Program Flow Charting How to tackle the beginning stage a program design.
Modules, Hierarchy Charts, and Documentation
Programming Logic and Design, Introductory, Fourth Edition1 Understanding Computer Components and Operations (continued) A program must be free of syntax.
COBOL for the 21 st Century Stern, Stern, Ley Chapter 1 INTRODUCTION TO STRUCTURED PROGRAM DESIGN IN COBOL.
Chapter 1 Program Design
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Chapter 3 Planning Your Solution
Programming Logic and Design Fourth Edition, Introductory
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.
COBOL for the 21st Century
Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Building Applications.
Your Interactive Guide to the Digital World Discovering Computers 2012.
Computer Science 101 Introduction to Programming.
Introduction 01_intro.ppt
Programming Languages CPS120: Introduction to Computer Science Lecture 5.
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)
Topics Introduction Hardware and Software How Computers Store Data
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.
Simple Program Design Third Edition A Step-by-Step Approach
CIS Computer Programming Logic
สาขาวิชาเทคโนโลยี สารสนเทศ คณะเทคโนโลยีสารสนเทศ และการสื่อสาร.
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)
Chapter 1: Introduction to Computers and Programming.
1 Computing Software. Programming Style Programs that are not documented internally, while they may do what is requested, can be difficult to understand.
Designing and Debugging Batch and Interactive COBOL Programs Chapter 5.
Chapter 1 Introduction to Computers and C++ Programming Goals: To introduce the fundamental hardware and software components of a computer system To introduce.
1 Interactive vs Batch Programs Cobol suited for developing both types of programs Interactive programs Accept input data from keyboard Input data processed.
CS CS Computing for Business Instructor:David Tucker GTA:Batul Mirza.
Chapter 7 File I/O 1. File, Record & Field 2 The file is just a chunk of disk space set aside for data and given a name. The computer has no idea what.
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.
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
Initial Steps in Program Development [Using problem defined in Ch. 1 of Stern & Stern]
1 The Procedure Division Chapter 4. 2 Main Two Sections File Section –Used to define files and record formats –Field names within records Working Storage.
CPSC3111/CISM3111 COBOL Structured COBOL Programming Text: murach’s structured COBOL Authors: Murach, Prince, Menendez.
Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout.
5-1 Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout John.
Structured COBOL Programming, Stern & Stern, 9th Edition CHAPTER 2 Cobol Language Fundamentals.
Introduction to programming Carl Smith National Certificate Year 2 – Unit 4.
Computer and Programming. Computer Basics: Outline Hardware and Memory Programs Programming Languages and Compilers.
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
371 Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout John.
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.
Program Design. Simple Program Design, Fourth Edition Chapter 1 2 Objectives In this chapter you will be able to: Describe the steps in the program development.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
Programming Languages
Topics Introduction Hardware and Software How Computers Store Data
CSCI-235 Micro-Computer Applications
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Unit# 8: Introduction to Computer Programming
Designing and Debugging Batch and Interactive COBOL Programs
Chapter 3 The DATA DIVISION.
An Introduction to Structured Program Design in COBOL
Topics Introduction Hardware and Software How Computers Store Data
Programming Logic and Design Eighth Edition
Presentation transcript:

Introductory Remarks

COURSE OBJECTIVES: (TAKEN FROM PREFACE) 1. To teach students how to design programs so that they are easy to read, debug, adapt, and maintain. 2. To provide students with the ability to write well-designed elementary and intermediate structured COBOL 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 standards that facilitate and promote the writing of well-designed structured programs. 5. To familiarize students with programming tools such as pseudo-code and hierarchy charts that make program logic more structured, modular, and top-down

FEATURES OF THE TEXT 1.Each chapter starts with A detailed chapter outline, and A list of objectives. 2.Each chapter contains many self-tests (and solutions) for self- examination. It is real important that you take these, as some of the test questions may come from these questions within the chapters. 3. Be sure to understand the key terms, and study the debugging exercises. Note that the programming assignments at the end of the chapter are in increasingly order of complexity.

AN INTRODUCTION TO STRUCTURED PROGRAM DESIGN IN COBOL TYPES OF COMPUTER PROGRAMS A program is a set of instructions that enable a computer to process data. 1.Operating system programs (systems software) - control the operations of the computer - such as overseeing the operations, providing input-output, managing memory, devices, processors, etc.; Operating systems programs (or systems software) also includes utility routines that assist system as well as application programmers, such as copy, format, dir, etc. 2.Applications programs - perform tasks required by users - e.g., Payroll programs. (Functional programs) Software - a term used to describe all types of programs.

Applications Program An applications program takes input data manipulates it (processes the data) and produces Output data. Therefore, we have the basic process: input - process - output Example: given data of hours worked, rate of pay: compute pay Input data: 1)number of hours, say 40, and 2)pay rate, say, 7.50 The Process is to take this data and multiply the two numbers to produce a product. To do this, we write a "payroll program" (pretty simple here, of course), that contains instructions to take (read, retrieve) two numbers and multiply them together to produce the product. Output data is the product, or, $30.00.

Custom Program Such an example is typical of applications programs and are written by ‘applications programmers.’ If an applications programmer were to take a general capability, such as a payroll program, and tailor it to a specific user's need, then we are said to tailor or customize the program. Example: a specific user of a standard payroll program may afford his/her employees some unique benefits, such as profit sharing or buying a bond a month from his/her check, for example. Another user may not. So to customize a payroll program (clearly a very simple example), an applications programmer might be required to add instructions in the program that subtracts $50.00 from an employees gross pay before calculating federal tax. This program is now tailored (or customized) to this users requirements.

Higher Level Languages Higher-level languages. COBOL, Fortran, Ada, C, Java, and others are said to be higher level languages, because they tend to be English-like - to a greater or lesser degree. Machine Language. Computer can only understand sequences of zeroes and ones, which is called machine language. For the computer to understand your COBOL program, your program must be translated from what you write into something that the machine can understand. The conversion from your "source program" into the machine language is called compilation (generically, ‘translation’), and a compiler (an example of a ‘systems program’) provides the translation for you.

Versions of Cobol History Department of Defense IBM - PL/1 Cobol 68, 74, 85, 2002, etc.

THE PROGRAM DEVELOPMENT PROCESS Requirements must be specified and understood. (Analysis). A ‘structured solution’ must be created from the specifications accompanied by a careful set of detailed procedures (that is, the logic) must be developed. This is the solution. (Design). Then, the design must be implemented in code (Programming). Then, after (and during) the coding itself, considerable testing must take place - at various levels. (Testing). The program(s) must then be installed in user environment. (Installation). Many other tasks are not included here such as Documentation User training, Follow on maintenance, and much more.. Let's look at each of these.

Specifications. After analyzing requirements, the business analyst or a system analyst working with the user, will write the software specifications.. Specifications (among many other things) contain (typically) the 1. Input data formats (data items and their characteristics.) 2. Outputs required (updated master file; printed reports, Narrative (this can take on many forms) Text, models, decision tables, and combinations. Note: input - process - output (again) These are the ‘whats’ of the application. Typical kinds of data...

Data Hierarchy File: a collection of ‘records’ that serve as input or output to a program. e.g. An employee file, an inventory file… Can be ‘organized’ and ‘accessed’ in many ways. Record: a collection of related ‘fields’ (data items) normally related and forming a group of items that relate to the subject at hand. e.g. An inventory record for a specific item in stock might contain fields such as: Stock number; Nomenclature; Unit cost; Reorder point; Quantity on hand, and more. Field: a collection of ‘characters,’ ‘numbers,’ etc. Such as a pay- rate, a name, an address, a ssan, etc.

Data Hierarchy File Record Field Character: (byte) a single character: alphabetic (letters of the alphabet and space), numeric, alphanumeric, special characters (e.g. For data transmission), non-printing characters, and more. Bit (contraction of binary digit) a ‘1’ or ‘0’ that represents a ‘state’ - on/off; yes/no; true/false, etc. Characters are composed of numbers of bits - usually seven or eight. Character set: EBCDIC; ASCII ; others. (Much more later)

Input and Output Specifications Normally contain: 1. Record layout forms - normally the typical input or output data descriptions. (See textbook). Record layouts indicate data items (fields) within each record;. Location of items within record, size, numeric, positions, fractional positions.. (Empnum, reghrs, others, rate, code) 2. Printer Layout Charts. report headers, column headers, precise print positions for the computed / printed output (detail lines); any summary or total lines, report numbers, page numbers,…. Menus and menu layouts; hierarchy of menus.. GUIs may be specified.

Design Architectural design Preliminary design External design Discussed earlier Building blocks Modules of application Structure charts All components of the application. Detail design Internal design Algorithm design The details of each module in application.

Detail (Program) design. This is program design (algorithmic design). Must plan your logic. (Program blueprint). Planning tools.. Flowcharts.. Pseudo code.. Hierarchy charts Program Flowchart - conventional block diagram. Shows the flow of logic (control) in a module Sequence Selection Iteration Pseudo-code - English-like statements (textual) Used for modeling logic Careful conventions Indentation

Language independence Modeling an algorithm - the thinking!! Program flowcharts. Graphical language. Used for modeling logic. Indented; careful conventions and symbols. Language independence. Used to model the algorithm Modeling the algorithm (design) is modeling a solution to problem from the problem space (Specifications) Hierarchy charts (HIPO) - Hierarchy plus input process output. Show relationships between parts of a program. Show dependencies. Specifically divide all activities into inputs, or outputs or processes.. Show specifically which inputs are needed by which processes to produce specific outputs.

Programming. Using the program logic shown via design, a programmer writes instructions (source program) in a source language (here, source language is Cobol.). Must be translated to machine language for computer to understand. (Translated / compiled). All programmer-created source language statements are built one at a time on disk and are entered into the computer via some kind of editor.. After the entire program is entered, we must now compile the source program.

SOURCE LANGUAGES TO DO: ab=c Fortran: c = a*b COBOL: Multiply A BY B GIVING C C and Java:c = a*b; Assembler: (IBM Mainframe): L 5,A M 4,B ST 5,C Higher level languages Source Program: (HLL) Fortran, Cobol, C, PL/1, Pascal, Java, C, Ada,... Assembler Languages - One to one w/machine language instructions Characteristics... Translators = compilers, assemblers, "interpreters"

TESTING THE PROGRAM 1. Syntax errors - compilation process. (Clean compile) (95% done? Really, 10% done!) 2. Logic errors - execution process - runs your program. The ‘real’ problems to debug Examples: 1. Comma versus period; misspell keyword; filename referred to not found Add instead of Multiply.. Program may or may not still run - but not correctly. May still go to EOJ!!! 3. Executing correctly-stated statements but not in the correct ‘order’ to get the job done.. Can be difficult to find. Eliminating compilation / execution (syntax / logic) errors is the norm. Called debugging!! This is really how one learns the language: program, program, program; make errors; learn.

IDENTIFICATION DIVISION. PROGRAM-ID. SAMPLE. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT EMPLOYEE-DATA ASSIGN TO “C:\COP2120\P4\JoeSchmuck\indata.txt”. SELECT PAY-LISTING ASSIGN TO “C:\COP2120\P4/JoeSchmuck\report.txt”. DATA DIVISION. FILE SECTION. FDEMPLOYEE-DATA LABEL RECORDS STANDARD. 01 EMPLOYEE-RECORD. 05EMPLOYEE-NAME-INPIC X(20). 05HOURS-WORKED-INPIC HOURLY-RATE-INPIC 9V99. FD PAYROLL-LISTING LABEL RECORDS ARE OMITTED. 01PRINT-REC. 05FILLER*PIC X(20). 05NAME-OUTPIC X(20). 05PIC X(10). 05HOURS-OUTPIC PIC X(8). 05RATE-OUTPIC PIC XXXXXX. 05WEEKLY-WAGES-OUTPIC WORKING-STORAGE SECTION. 01ARE-THERE-MORE-RECSPIC XXX VALUE ‘YES’.

PROCEDURE DIVISION. 100-MAIN-MODULE. OPEN INPUT EMPLOYEE-DATA OUTPUT PAYROLL-LISTING. READ EMPLOYEE-DATA AT END MOVE ‘NO’ TO ARE-THERE-MORE-RECS END-READ. PERFORM 200-WAGE-ROUTINE UNTIL ARE-THERE-MORE-RECS = ‘NO’. CLOSE EMPLOYEE-DATA PAYROLL-LISTING. STOP RUN. 200-WAGE-ROUTINE. MOVE SPACES TO PRINT-REC. MOVE EMPLOYEE-NAME-IN TO NAME-OUT. MOVE HOURS-WORKED TO HOURS-OUT. MOVE HOURLY-RATE-IN TO RATE-OUT. MULTIPLY HOURS-WORKED-IN BY HOURLY-RATE-IN GIVING WEEKLY-WAGES-OUT. WRITE PRINT-REC. READ EMPLOYEE-DATA AT END MOVE ‘NO’ TO ARE-THERE-MORE-RECS END-READ.

MUCH TO SAY..... Divisions, section, paragraphs, ‘areas.’. Input ‘formats’ output ‘formats’. See size and classification of data. Input/output descriptions: movement of data. Choices of data names; standards.. Formatting standards. Internal documentation. Value clauses

COBOL PROGRAM FLOWCHART FOR SAMPLE PROGRAM