Totals on the Screen Please use speaker notes for additional information!

Slides:



Advertisements
Similar presentations
Creating an Oracle Database Table Additional information is available in speaker notes!
Advertisements

Check Digit - Mod 11 Please use speaker notes for additional information!
2-1 Chapter 2.  Coding Requirements of IDENTIFICATION DIVISION  Sections of ENVIRONMENT DIVISION  Assigning Files to Devices in ENVIRONMENT DIVISION.
Final Total Lines in COBOL Please be sure you can see the speaker notes - they contain additional information!
BY: JOSHUA THOMAS IGNATIUS TOWERS COBOL. Overview What is COBOL History Design Implementations What did it do Program structure Data types Syntax Sample.
Chapter 15 Indexed Sequential Files. Disk File Organization File is collection of records Three major ways records stored or organized on disk - Sequential.
Screen Section Please use speaker notes for additional information!
Processing with VSAM Files Please use speaker notes for additional information!
PL/SQL - Using IF statements Please use speaker notes for additional information!
COBOL for the 21 st Century Stern, Stern, Ley Chapter 1 INTRODUCTION TO STRUCTURED PROGRAM DESIGN IN COBOL.
COBOL COmmon Business Oriented Language  Work began in 1959 and has never stopped.
COBOL for the 21st Century
Two and three dimension tables Please use speaker notes for additional information!
Relative Files.. Creating a Relative File $ SET SOURCEFORMAT"FREE" IDENTIFICATION DIVISION. PROGRAM-ID. CreateRelativeFromSeq. * Creates a Relative file.
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)
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)
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.
InvEasy (Project1) Please use speaker notes for additional information!
Introduction to COBOL. COBOL  COBOL is an acronym which stands for Common Business Oriented Language.  The name indicates the target area of COBOL applications.
Modifications to program Addda.cbl Please use speaker notes for additional information!
History COBOL (Common Business Oriented Language) was one of the earliest high-level programming languages. COBOL was first proposed in 1959 by the Conference.
Programming Examples to Accompany Structure Topic Please use speaker notes for additional information!
COBOL Cobol is one of the most robust language in the software field, so far Cobol turned 50, in 2009 Cobol has stood the test of time Common Business.
More on variables with Oracle’s SQL*Plus As always, speaker notes will contain additional information!
Agenda Reporting Work on Assignment 4! Printing on power systems.
Lecture 31 Numeric Edited Alphabetic (A) AlphaNumeric (X) Numeric (9, V, S) Numeric Edited (9, Z, comma, decimal point, minus sign) –Z = zero suppressed.
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.
UNIT 1 UNIT 1 Stephen S. Linkin Houston Community College System 8/28/ Copywrite © Houston Community College System 2007 Graphics Courtesy of IBM.
Module 4 Constants Copy Statement Perform Verb Part 1.
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.
COBOL Basics 2. H E N N E S S Y R M L M F Group Items/Records StudentDetails WORKING-STORAGE SECTION. 01StudentDetailsPIC X(26).
Array - adding to array at run time Please see speaker notes for additional information!
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.
Edit Programs Please use speaker notes for additional information. Example: payedit.cbl payedit.cbl.
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.
Explanation of SAMPLEIF (if88in1.cbl or if88in1.html) Please use speaker notes for additional information!
Manipulating data within PL/SQL Please use speaker notes for additional information!
HELLO WORLD program in COBOL - CIS12 Please use speaker notes for additional information!
11- 1 Chapter 11.  Avoiding Logic Errors by Validating Input  What to Do If Input Errors Occur  Global Considerations in COBOL  When Data Should Be.
Any Questions!. Test Coming Up! Agenda Printing with Externally Described Printer Files Arrays.
COBOL Screens Please use speaker notes for additional information!
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.
Any Questions? Agenda Level 77 Initialize Display & Accept Arithmetic Verbs Compute statement String/Unstring Inspect.
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.  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.
Module 1 1. Cobol Hierarchy Revised on COBOL Hierarchy There are four DIVISIONS:- IDENTIFICATION DIVISION. ENVIRONMENT DIVISION. DATA DIVISION.
Programming Assignment #2 in CIS12 Please use speaker notes for additional information!
COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
Analysis of SAMPLE1.CBL Please check speaker notes for additional information!
Introduction to PL/SQL As usual, use speaker notes for additional information!
Indexed Files.. Creating an Indexed File $ SET SOURCEFORMAT"FREE" IDENTIFICATION DIVISION. PROGRAM-ID. CreateIndexedFromSeq. * Creates an indexed file.
Chapter 4 PROCEDURE DIVISION. Paragraphs PROCEDURE DIVISION divided into paragraphs Each is independent module or routine Made up of series of instructions.
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.
Random update Please use speaker notes for additional information!
Sequential Processing to Update a File Please use speaker notes for additional information!
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.
General Introduction Algorithms. Let’s write a program  A program is a collection of statements written in a language the computer understands.  A computer.
Any Questions?.
An Introduction to Structured Program Design in COBOL
HOW TO CREATE A CLASS Steps:
Indexed File Processing
Using screens and adding two numbers - addda.cbl
Date Conversion Program
Presentation transcript:

Totals on the Screen Please use speaker notes for additional information!

Totals IDENTIFICATION DIVISION. PROGRAM-ID. READ1. AUTHOR. GROCER ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT PAY-FILE ASSIGN TO "A:\PAY.DAT". DATA DIVISION. FILE SECTION. FD PAY-FILE DATA RECORD IS PAY-REC. 01 PAY-REC. 05 PAY-ID PIC PAY-NAME PIC X(20). 05 PAY-TYPE PIC X. 05 PAY-RATE PIC 999V PAY-HOURS PIC 99. WORKING-STORAGE SECTION. 01 INDICATORZ. 05 EOF-IND PIC X VALUE "N". 05 CONTINUE-ANS PIC X VALUE SPACES. 01 WORK-AREAS. 05 TOT-RECORDS PIC 99 VALUE TOT-HOURS-WORKED PIC 9999 VALUE SCREEN-OUTPUT-AREAS. 05 PAY-RATE-SCR PIC ZZZ TOT-RECORDS-SCR PIC Z9. 05 TOT-HOURS-WORKED-SCR PIC Z,ZZ9. These formatted fields will display the totals on the screen. These two fields will be added to as the totals are accumulated. This has nothing to do with totals, I simply want to display the pay rate with a decimal point and suppressed leading zeros.

PROCEDURE DIVISION. MAINLINE. PERFORM A-100-STARTUP. PERFORM B-100-PROCESS. PERFORM C-100-WRAPUP. STOP RUN. A-100-STARTUP. OPEN INPUT PAY-FILE. B-100-PROCESS. READ PAY-FILE AT END MOVE "Y" TO EOF-IND. PERFORM B-200-LOOP UNTIL EOF-IND = "Y". B-200-LOOP. DISPLAY "THE ID IS " PAY-ID. DISPLAY "THE NAME IS " PAY-NAME. DISPLAY "THE PAY TYPE IS " PAY-TYPE. MOVE PAY-RATE TO PAY-RATE-SCR. DISPLAY "THE PAY RATE IS " PAY-RATE-SCR. DISPLAY "THE HOURS WORKED IS " PAY-HOURS. ADD 1 TO TOT-RECORDS. ADD PAY-HOURS TO TOT-HOURS-WORKED. DISPLAY " ". DISPLAY "PRESS ENTER TO CONTINUE". ACCEPT CONTINUE-ANS. READ PAY-FILE AT END MOVE "Y" TO EOF-IND. Totals As the records are processed, I accumulate the totals. I want to count the total number of records so I add 1 to TOT-RECORDS. I want to accumulate the total of what is in all of the PAY- HOURS fields, so I add PAY- HOURS to TOT-HOURS- WORKED. This has nothing to do with the totals, but I want to display PAY-RATE with a decimal point, so I move it to the edited field shown on the previous slide.

C-100-WRAPUP. MOVE TOT-RECORDS TO TOT-RECORDS-SCR. DISPLAY "THE TOTAL NUMBER OF RECORDS IS: " TOT-RECORDS-SCR. MOVE TOT-HOURS-WORKED TO TOT-HOURS-WORKED-SCR. DISPLAY "THE TOTAL HOURS WORKED IS: " TOT-HOURS-WORKED-SCR. CLOSE PAY-FILE. Totals At end of file, processing terminates and control passes to C-100-WRAPUP. In that paragraph I move the totals that I have been accumulating to an edited area to suppress leading zeros and I display the totals with a literal identifying the total.

1111John Doe F Linda Harris P Susan Ash F David Costa F Ann French F Richard Morse P Totals

1111John Doe F WORK-AREAS. 05 TOT-RECORDS PIC 99 VALUE TOT-HOURS-WORKED PIC 9999 VALUE 0. TOT-RECORDS TOT-HOURS-WORKED Linda Harris P TOT-RECORDS TOT-HOURS-WORKED Susan Ash F TOT-RECORDS TOT-HOURS-WORKED 3100

5555Ann French F TOT-RECORDS TOT-HOURS-WORKED 3100 Totals 4444David Costa F TOT-RECORDS TOT-HOURS-WORKED 4140 After processing three records on previous slide. 6666Richard Morse P TOT-RECORDS TOT-HOURS-WORKED 5175 TOT-RECORDS TOT-HOURS-WORKED 6190