Structured Programming

Slides:



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

2-1 Chapter 2.  Coding Requirements of IDENTIFICATION DIVISION  Sections of ENVIRONMENT DIVISION  Assigning Files to Devices in ENVIRONMENT DIVISION.
3-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emertius)
Chapter 1: Introduction
The IDENTIFICATION and ENVIRONMENT DIVISIONS Chapter 2.
1 Chapter 9 - Formatted Input/Output Outline 9.1Introduction 9.2Streams 9.3Formatting Output with printf 9.4Printing Integers 9.5Printing Floating-Point.
Chapter 9 Formatted Input/Output Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 9 - Formatted Input/Output Outline 9.1Introduction.
Data types and variables
Modules, Hierarchy Charts, and Documentation
Chapter 2 Data Types, Declarations, and Displays
COBOL for the 21 st Century Stern, Stern, Ley Chapter 1 INTRODUCTION TO STRUCTURED PROGRAM DESIGN IN COBOL.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the structure of a C-language program. ❏ To write your first C.
COBOL COmmon Business Oriented Language  Work began in 1959 and has never stopped.
Chapter 3: Introduction to C Programming Language C development environment A simple program example Characters and tokens Structure of a C program –comment.
PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert.
CS102 Introduction to Computer Programming
© The McGraw-Hill Companies, 2006 Chapter 1 The first step.
Chapter 2 Data Types, Declarations, and Displays.
Objectives You should be able to describe: Data Types
A First Book of ANSI C Fourth Edition
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Streams Streams –Sequences of characters organized.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 9 - Formatted Input/Output Outline 9.1Introduction.
Structured COBOL Programming, Stern & Stern, 9th edition
COBOL Basics 1. COBOL coding rules  Almost all COBOL compilers treat a line of COBOL code as if it contained two distinct areas. These are known as;
Chapter 9 Formatted Input/Output. Objectives In this chapter, you will learn: –To understand input and output streams. –To be able to use all print formatting.
Programming Logic and Design Sixth Edition Chapter 2 Working with Data, Creating Modules, and Designing High-Quality Programs.
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)
A Variable is symbolic name that can be given different values. Variables are stored in particular places in the computer ‘s memory. When a variable is.
Chapter To familiarize you with  Why COBOL is a popular business-oriented language.  Programming practices and techniques  History of COBOL.
3-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emertius)
Introduction to COBOL. COBOL  COBOL is an acronym which stands for Common Business Oriented Language.  The name indicates the target area of COBOL applications.
History COBOL (Common Business Oriented Language) was one of the earliest high-level programming languages. COBOL was first proposed in 1959 by the Conference.
1 © 2000 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.
Input, Output, and Processing
The DATA DIVISION Chapter 3. COBOL Data Organization Field - group of characters forming a meaningful unit or basic fact –Characters in a name or digits.
3-1 Chapter 3. To familiarize you with  Ways in which data is organized in COBOL  Rules for forming data-names  Defining input and output files in.
3-1 The DATA DIVISION Chapter Chapter Objectives To familiarize you with Systems design considerations Ways in which data is organized Rules for.
Module 4 Constants Copy Statement Perform Verb Part 1.
CS CS Computing for Business Instructor:David Tucker GTA:Batul Mirza.
Copyright © 2012 Pearson Education, Inc. Chapter 2: Introduction to C++
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
Course Title: Object Oriented Programming with C++ instructor ADEEL ANJUM Chapter No: 03 Conditional statement 1 BY ADEEL ANJUM (MSc-cs, CCNA,WEB DEVELOPER)
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
1 IDENTIFICATION and ENVIRONMENT DIVISIONS. 2 Objectives Basic Structure of COBOL Programs General Coding and Formatting Rules Identification and the.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 2: Introduction to C++
Structured COBOL Programming, Stern & Stern, 9th Edition CHAPTER 2 Cobol Language Fundamentals.
Chapter 2 Using Variables and Constant. What is a Constant ? The data in COBOL programs falls in two broad categories: – Constants and Variables A constant.
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.
1.  Introduction  The Benefits of the Report Writer Module ◦ For Detail and Summary Printing ◦ For Control Break Processing ◦ For Printing Headings.
IBM-Mainframes COBOL Class-1. Background and History  COBOL is an acronym for: Common Business Oriented Language  COBOL was developed in 1959 by the.
COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
Scott Marino MSMIS Kean University MSAS5104 Programming with Data Structures and Algorithms Week 1 Scott Marino.
Topics Designing a Program Input, Processing, and Output
BASIC ELEMENTS OF A COMPUTER PROGRAM
Structured Programming
TMF1414 Introduction to Programming
Programming in COBOL.
An Object-Oriented Approach to Programming Logic and Design Fourth Edition Chapter 2 Applications and Data.
Designing and Debugging Batch and Interactive COBOL Programs
2.1 Parts of a C++ Program.
Chapter 3 The DATA DIVISION.
An Introduction to Structured Program Design in COBOL
CHAPTER 17 The Report Writer Module
Chapter 2: Introduction to C++.
Topics Designing a Program Input, Processing, and Output
Topics Designing a Program Input, Processing, and Output
Programming in COBOL.
Presentation transcript:

Structured Programming Language ITSS113

Lecture-1 : INTRODUCTION Learning Objectives: To provide brief history of COBOL To learn the capabilities and limitations of COBOL To present the program layout of COBOL To discuss the structure of a COBOL program To determine the difference between COBOL Literal Set, COBOL Words, COBOL Literals

Introduction to COBOL COBOL Common Business Oriented Language A third-generation programming language, Was one of the earliest high-level programming languages; still widely used today. First proposed in 1959 by the Conference on Data Systems Languages (CODASYL). Three ANSI standards for COBOL have been produced in 1968, 1974 and 1985. Object-oriented COBOL is the fourth edition in the continuing evolution of ANSI/ISO standard COBOL.

Underlining Philosophy Like the name suggests, COBOL was meant to be ‘common’ or compatible among a significant group of manufacturers COBOL is designed for developing business, typically file-oriented, applications, and is not designed for writing systems programs. Primary domain in business, finance, and administrative systems for companies and governments.

Pro’s and Con’s Advantages Disadvantages Simple Portable Maintainable very wordy has a very rigid format not designed to handle scientific applications

Distinct features The language is simple No pointers No user defined types No user defined functions ‘Structure like’ data types File records are also described with great detail, as are lines to be output to a printer COBOL is self documenting

COBOL program layout The layout, or format, or a COBOL program follows certain simple rules, which originated long ago when programs were punched onto 80-column punch cards. COBOL programs are written in coding sheets. There are 80 columns in a line of the coding sheet.

COBOL program layout (continued) Column Field 1-3 Page Number 4-6 Line Number (1-6 Sequence Number) 7 Continuation / Comment 8-11 A – Margin / Area A 12-72 B- Margin /Area B 73-80 Identification

Structure of COBOL Program COBOL programs are hierarchical in structure. Each element of the hierarchy consists of one or more subordinate elements. The levels of hierarchy are Divisions, Sections, Paragraphs, Sentences and Statements There are 4 main divisions and each division provides an essential part of the information required by the complier

Structure of COBOL Program (continued) At the top of the COBOL hierarchy are the four divisions. The sequence in which they are specified is fixed, and must follow the order: IDENTIFICATION DIVISION. This division’s primary purpose is to name the program ENVIRONMENT DIVISION. This division is primarily used to tell the computer about the input and output devices such files or printers. DATA DIVISION provides descriptions of the data-items/fields processed by the program. PROCEDURE DIVISION contains the code used to manipulate the data described in the DATA DIVISION. It is here that the programmer describes his algorithm. Note: Some COBOL compilers require that all the divisions be present in a program while others only require the IDENTIFICATION DIVISION and the PROCEDURE DIVISION

Hello World Example 000100 IDENTIFICATION DIVISION. 000200 PROGRAM-ID. HELLOWORLD. 000300 000400 ENVIRONMENT DIVISION. 000500 CONFIGURATION SECTION. 000600 SOURCE-COMPUTER. RM-COBOL. 000700 OBJECT-COMPUTER. RM-COBOL. 000800 000900 DATA DIVISION. 001000 FILE SECTION. 001100 101200 PROCEDURE DIVISION. 101300 101400 MAIN-LOGIC SECTION. 101500 DISPLAY "Hello world!" 101600 STOP RUN.

Character Set There are 50 different characters in COBOL character set. 0-9 (10 numerals) A-Z (26 English alphabets-only capital letters) – (minus sign or hyphen) + (Plus sign) * (Asterisk) / (Slash) = (Equal sign) $ (Currency sign) , (Comma) ; (Semi colon) . (Period or decimal point) “ (Quotation mark) ( (Left Parenthesis ) ) (Right Parenthesis) > (Greater than symbol) < (Less than symbol)

Character Set (continued) The characters 0-9 are called numeric characters or digits. The characters A-Z are called letters The remaining characters are called special characters. The space or blank character in certain cases is treated as a letter.

COBOL WORDS There are 2 types of words in COBOL: 1.) Reserved word A COBOL word can be formed using the following characters: 0-9 A-Z (a-z) - (hyphen) There are 2 types of words in COBOL: 1.) Reserved word 2.) User-defined word

COBOL WORDS (continued) Paragraph names, Identifiers, File names can be defined by users. The following rules must be adhered in forming COBOL user-defined words: 1.) A word cannot begin or end with a hyphen. 2.) A word can have at the maximum 30 characters. 3.) One of the characters must be a letter. (Some compilers put the additional restrictions that the first character must be a letter.) 4.) Except hyphen (-) no special character allowed. 5.) Cannot be a COBOL reserved word.

COBOL WORDS (continued) Examples Valid Word Invalid Word Reason emp-sal -pay (it starts with a hyphen) NET-SAL TOTAL MARK (blank space embedded) N100 COMPUTE (Reserved word) 23 (No letter)

Literals The actual values can also appear in a program. Such values are known as literals. A data name may have different values at different points of time whereas a literal means the specific value which remains unchanged throughout the execution of the program. For this reason a literal is often called a constant. Moreover the literal is not given a name; it represents itself and does not require to be defined in the DATA DIVISION.

Literals (continued) There are 3 types of literals: Numeric. Formed by digits only. It can have a sign (+ or -) and can have a decimal point also. b) Nonnumeric. Use in general to output messages or headings. Characters that are enclosed between “ “ constitute nonnumeric literal. c) Figurative Constants. Have some fixed names and the compiler recognizes these names and it sets up corresponding values in the object program.

Literals (continued) Figurative Constant Meaning ZERO ZEROS ZEROES value 0 SPACE SPACES One or more blanks HIGH-VALUE HIGH-VALUES Highest value in the Collating sequence LOW-VALUE LOW-VALUES Lowest value in the QUOTE QUOTES one or more of “ ALL literal one or more of the string characters comprising the literal

Summary Brief history or COBOL Underlining Philosophy of COBOL Distinct Features of COBOL COBOL Program Layout Structure of COBOL program Character Set COBOL Words Literals Summary of the chapter or topic