Chapter 4 PROCEDURE DIVISION. Paragraphs PROCEDURE DIVISION divided into paragraphs Each is independent module or routine Made up of series of instructions.

Slides:



Advertisements
Similar presentations
DT266/2 Information Systems COBOL Revision. Chapters 1 & 2 Hutty & Spence Divisions of a Cobol Program Identification Division Program-ID. Environment.
Advertisements

Structured COBOL Programming
Chapter 12 Array Processing and Table Handling. Defining Series of Input Fields Coding record with 24 independent hourly fields is cumbersome 01Temp-Rec.
2-1 Chapter 2.  Coding Requirements of IDENTIFICATION DIVISION  Sections of ENVIRONMENT DIVISION  Assigning Files to Devices in ENVIRONMENT DIVISION.
Chapter 15 Indexed Sequential Files. Disk File Organization File is collection of records Three major ways records stored or organized on disk - Sequential.
The IDENTIFICATION and ENVIRONMENT DIVISIONS Chapter 2.
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)
14-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 2 Basic Elements of Fortan
Writing a Complete Program
Understanding the Mainline Logical Flow Through a Program (continued)
Pseudocode.
COBOL for the 21 st Century Stern, Stern, Ley Chapter 1 INTRODUCTION TO STRUCTURED PROGRAM DESIGN IN COBOL.
Pseudocode.
- Meeting 4 – Writing a Complete Program
COBOL for the 21st Century
Structured COBOL Programming
Exploring Microsoft Excel 2002 Chapter 8 Chapter 8 Automating Repetitive Tasks: Macros and Visual Basic for Applications By Robert T. Grauer Maryann Barber.
DCT 1123 Problem Solving & Algorithms
Any Questions!. Agenda Fun with Functions –how to get the system date Condition Names INDARA and SI Iteration Logical Files Positioning the file pointer.
VSAM KSDS and COBOL Department of Computer Science Northern Illinois University August 2005 Some of the illustrations are from VSAM: Access Method Services.
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)
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)
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)
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.
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)
Programming Examples to Accompany Structure Topic Please use speaker notes for additional information!
PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert.
Programming in COBOL-85 For IBM Mainframe System 390 Jyothi Sridhar Kini E&R, Infosys Mail-id: Phone:
Designing and Debugging Batch and Interactive COBOL Programs Chapter 5.
Python – Part 1 Python Programming Language 1. What is Python? High-level language Interpreted – easy to test and use interactively Object-oriented Open-source.
BIS 1753 Introduction to Computer Programming 1. Computer Program A set of instructions that enables a computer to process data Also called software Two.
Lecture 31 Numeric Edited Alphabetic (A) AlphaNumeric (X) Numeric (9, V, S) Numeric Edited (9, Z, comma, decimal point, minus sign) –Z = zero suppressed.
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.
1 Interactive vs Batch Programs Cobol suited for developing both types of programs Interactive programs Accept input data from keyboard Input data processed.
14- 1 Chapter 14.  To familiarize you with ◦ How files may be sorted ◦ How to process file during SORT procedure  Before it is sorted  After it is.
Indexed and Relative File Processing
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.
Statement Syntax1 THE SELECT STATEMENT Purpose: designates a file and points to its physical location Syntax Definition : SELECT file-name-1 ASSIGN TO.
CPSC3111/CISM3111 COBOL Structured COBOL Programming Text: murach’s structured COBOL Authors: Murach, Prince, Menendez.
Chapter 2 Pseudocode. Objectives To introduce common words, keywords and meaningful names when writing pseudocode To define the three basic control structures.
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.
Structured COBOL Programming, Stern & Stern, 9th Edition CHAPTER 2 Cobol Language Fundamentals.
1 Chapter 5 – The Procedure Division File handling statements –OPEN statement Initiates processing for a file Input Output Each file opened must have been.
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.
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.
The PERFORM. The PERFORM Verb  Iteration is an important programming construct. We use iteration when we need to repeat the same instructions over and.
Week 2/3 - 2nd Lecture Intro to COBOL Programming Defining Files and Processing Data.
Introduction to Sequential Files. COBOL's forte  COBOL is generally used in situations where the volume of data to be processed is large.  These systems.
Keyboard Input and Screen Display ––––––––––– Interactive Programming
Designing and Debugging Batch and Interactive COBOL Programs
Chapter 3 The DATA DIVISION.
An Introduction to Structured Program Design in COBOL
Chapter 14 Sorting and Merging.
Iteration: Beyond the Basic PERFORM
Iteration: Beyond the Basic PERFORM
CHAPTER 17 The Report Writer Module
Data Groupings: File File: a group of related records
Writing a Complete Program
Presentation transcript:

Chapter 4 PROCEDURE DIVISION

Paragraphs PROCEDURE DIVISION divided into paragraphs Each is independent module or routine Made up of series of instructions to perform specific set of operations

Structure of the PROCEDURE Division Paragraph names Statements –All statements begin with a verb –PERFORM Statement Stopping execution of the program

Structure of the PROCEDURE Division Zone A –PROCEDURE DIVISION. –All paragraph names. Zone B –All statements –The last statement in a paragraph is followed by a period

PROCEDURE DIVISION Contains instructions to Read data Process data Produce output Perform end-of-job operations

Verbs OPEN READ –AT END –NOT AT END WRITE CLOSE MOVE PERFORM –PERFORM UNTIL STOP RUN

OPEN Statement INPUT file-name-1 … OPEN OUTPUT file-name-2 … File-names used must appear in SELECT statement (ENVIRONMENT DIVISION) File must be accessed with OPEN before reading from or writing to it FORMAT

READ Statement READ file-name-1 AT END statement-1 … [NOT AT END statement-2 …] [END-READ] File-name appears in SELECT statement, FD entry and OPEN AT END tests if there are more records FORMAT

PERFORM UNTIL … END-PERFORM PERFORM UNTIL condition-1 statement-1... [END-PERFORM] Repeatedly executes statement(s) between PERFORM UNTIL … END- PERFORM until condition specified in UNTIL clause is met FORMAT

Simple PERFORM PERFORM paragraph-name To execute instructions in separate paragraph or module one time Transfers control to named paragraph Executes all instructions in paragraph Control returns to statement following PERFORM FORMAT

Out-Of-Line PERFORM PERFORM paragraph-name UNTIL condition Repeats paragraph until condition met Control transfers to named paragraph Executes instructions in paragraph and returns FORMAT

In-Line PERFORM PERFORM UNTIL condition statement(s) END-PERFORM Repeats statement(s) until condition met Statement(s) to be executed are in-line, not in separate paragraph FORMAT

MOVE statement MOVE identifier-1 TO identifier-2 Copies contents of identifier-1 to identifier- 2 FORMAT

WRITE statement WRITE record-name-1 Transmits data from output record area to associated file on device specified Record-name is 01 level name following FD for a file opened for output READ file-name, WRITE record-name FORMAT

CLOSE statement CLOSE file-name-1... Close all files opened Indicates files no longer needed for processing Releases files and deactivates devices FORMAT

STOP RUN Terminates the program Usually last instruction in main module Execution continues with next paragraph if STOP RUN is omitted

PROCEDURE DIVISION Batch processing instructions –Access files and read them –Write output to files Interactive processing instructions –Accept input from keyboard –Display output on screen

Batch Programs Review Programs that process large quantity of data stored in files Require ENVIRONMENT DIVISION Require FILE SECTION in DATA DIVISION Use OPEN, READ, WRITE, CLOSE verbs to process files

Interactive Program Statements DISPLAY to prompt for input ACCEPT to store input in WORKING- STORAGE areas Various statements to process input DISPLAY to show output DISPLAY to ask if there is more input ACCEPT to get response