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)

Slides:



Advertisements
Similar presentations
Structured COBOL Programming
Advertisements

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)
12-1 Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout John.
8-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)
16-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)
The Future of COBOL A Focus on Interactive Programming Appendix C Stern & Stern.
© Copyright 2011 John Wiley & Sons, Inc.
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 15 Creating Database Forms and Reports Introduction Forms Reports.
Chapter 5: Database Forms and Reports
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)
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)
COBOL for the 21 st Century Stern, Stern, Ley Chapter 1 INTRODUCTION TO STRUCTURED PROGRAM DESIGN IN COBOL.
COBOL for the 21st Century
Accounting Information Systems, 1st Edition
Structured COBOL Programming
Introduction to Databases
PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert.
Systems Analysis and Design
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)
Accounting Principles, Ninth Edition
12-1 Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout John.
12-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)
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)
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.
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)
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)
PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert.
John Wiley & Sons, Inc. © 2005 Chapter 2 The Recording Process Prepared by Naomi Karolinski Monroe Community College and and Marianne Bradford Bryant.
PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert.
MODERN AUDITING 7th Edition Developed by: Gregory K. Lowry, MBA, CPA Saint Paul’s College John Wiley & Sons, Inc. William C. Boynton California Polytechnic.
PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert.
5-1 Chapter 5 The Repetition Process in VB.NET. 5-2 Learning Objectives Understand the importance of the repetition process in programming. Describe the.
7-1 Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout John.
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 The Procedure Division Chapter 4. 2 Main Two Sections File Section –Used to define files and record formats –Field names within records Working Storage.
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)
Copyright © 2000 John Wiley & Sons, Inc. All rights reserved
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.
PowerPoint Presentation for Dennis & Haley Wixom, Systems Analysis and Design, 2 nd Edition Copyright 2003 © John Wiley & Sons, Inc. All rights reserved.
Slide 1-1 Chapter 1 Terms Information Systems Overview Introduction to Information Systems Judith C. Simon.
5-1 Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout John.
Copyright © 2000 John Wiley & Sons, Inc. All rights reserved. Reproduction or translation of this work beyond that permitted in Section 117 of the 1976.
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)
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.
COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
12-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 4 PROCEDURE DIVISION. Paragraphs PROCEDURE DIVISION divided into paragraphs Each is independent module or routine Made up of series of instructions.
Slide 8-1 Chapter 8 Terms Programming Languages Introduction to Information Systems Judith C. Simon.
A- 1. A- 2 Appendix B Standards of Ethical Conduct for Management Accountants The Institute of Management Accountants has published and promoted the following.
K-1. K-2 Appendix K Standards of Ethical Conduct for Management Accountants The Institute of Management Accountants has published and promoted the following.
Slide 11-1 Chapter 11 Terms Information Resource Management Strategies Introduction to Information Systems Judith C. Simon.
I-1. I-2 I ACCOUNTING FOR SOLE PROPRIETORSHIPS Accounting, Fifth Edition.
Slide 6-1 Chapter 6 Terms System Software Considerations Introduction to Information Systems Judith C. Simon.
liquidation of a partnership.
Designing and Debugging Batch and Interactive COBOL Programs
Structured COBOL Programming
Presentation transcript:

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) John Wiley & Sons, Inc. 11th edition

4-2 Coding Complete COBOL Programs: The PROCEDURE DIVISION Chapter 4

4-3 Chapter Objectives 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 4.Write information to an output file 5.Accomplish end-of-job operations 6.Execute paragraphs from main module, return control to that main module

4-4 Review of Data Division DATA DIVISION –FILE SECTION Detailed description of input/output records –WORKING-STORAGE SECTION Defines keyed input, displayed output Defines fields needed for processing but not part of input/output records

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

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

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

4-8 Rules for Paragraph-Names Coded in Area A, followed by period Follow rules for forming data-names except may be all digits –1010, 1020, 1030, etc. are valid paragraph names, but NOT RECOMMENDED Must be unique

4-9 Procedure Division Statements All statements coded in Area B Statement begins with verb (READ, MOVE) Last statement in paragraph ends with period Sentence - series of statements ending with period

4-10 Batch Program Instructions OPEN - to open files to be processed PERFORM UNTIL … END-PERFORM –Loop to continually READ and process input records and WRITE results to output file until there are no more records CLOSE - to close files when done processing STOP RUN - to end program

4-11 OPEN Statement Accesses and makes files available for processing Identifies whether files will be used for input or output

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

4-13 OPEN statement example May use a single OPEN statement Open Input Payroll-File-In Output PayChecks-File-Out, Err-List-File-Out May use multiple OPEN statements, but NOT RECOMMENDED Open Input Payroll-File-In Open Output PayChecks-File-Out Open Output Err-List-File-Out

4-14 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

4-15 PERFORM UNTIL … END-PERFORM In typical batch program, instructions repeated until no more records in file When condition met, program continues with statement following END-PERFORM

4-16 PERFORM UNTIL … END-PERFORM Perform Until WS-More-Data = 'NO' Read Payroll-File-In At End Move 'NO' To WS-More-Data Not At End Perform 200-Process-Record End-Read End-Perform EXAMPLE

4-17 PERFORM UNTIL … END-PERFORM Assume WS-More-Data initially = 'YES' –Condition not met, so statements in PERFORM loop will be executed WS-More-Data set to 'NO' when MOVE statement executed –When condition checked again loop ends since condition has been met

4-18 READ Statement Reads record from file opened for input Transfers record to input storage area Makes one record available at a time, not entire file

4-19 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

4-20 READ Statement If no more records –Executes statement(s) after AT END –Typically statement(s) to cause loop containing READ to end If more records –Reads in next record –Executes statement(s) after NOT AT END –Typically statement(s) to process record just read

4-21 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

4-22 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

4-23 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

4-24 End-Of-Job Processing Steps performed after all records processed Release all files Terminate processing

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

4-26 Closing multiple files May use a single CLOSE statement Close Payroll-File-In PayChecks-File-Out Err-List-File-Out May use multiple CLOSE statements, but NOT recommended Close Payroll-File-In Close PayChecks-File-Out Close Err-List-File-Out

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

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

4-29 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

4-30 Comments in COBOL Start with asterisk (*) in column 7 Use as reminders and explanations of processing performed by program Use to describe program in IDENTIFICATION DIVISION Use to describe each module in PROCEDURE DIVISION

4-31 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

4-32 Chapter Summary Batch Program Structure –Main module's in-line PERFORM UNTIL repeatedly executes READ statement –READ gets and processes next record until there are no more –Files are opened before PERFORM loop and closed after loop ends

4-33 Chapter Summary Paragraph-names coded in Area A and end with period All other PROCEDURE DIVISION statements coded in Area B Statements executed in order unless –PERFORM UNTIL loop executes –PERFORM transfers control to another paragraph

4-34 Copyright © 2003 John Wiley & Sons, Inc. All rights reserved. Reproduction or translation of this work beyond that permitted in Section 117 of the 1976 United States Copyright Act without the express written permission of the copyright owner is unlawful. Request for further information should be addressed to the Permissions Department, John Wiley & Sons, Inc. The purchaser may make back-up copies for his/her own use only and not for distribution or resale. The Publisher assumes no responsibility for errors, omissions, or damages, caused by the use of these programs or from the use of the information contained herein. Limited modifications to original presentation.