Edit Programs Please use speaker notes for additional information. Example: payedit.cbl payedit.cbl.

Slides:



Advertisements
Similar presentations
Chapter 12 Array Processing and Table Handling. Defining Series of Input Fields Coding record with 24 independent hourly fields is cumbersome 01Temp-Rec.
Advertisements

1 of 39 DA1245 Enhanced Transaction Tracking Last updated: March-2009 DA1245 Enhanced Transaction Tracking.
ICEPU – IC ENTRY PHSYICAL UPDATE Use this function to update or clear the completed runs after you complete entry and reconciliation. Post the adjustments.
Final Total Lines in COBOL Please be sure you can see the speaker notes - they contain additional information!
Accounts Payable–1099 Processing 1Freedom Systems – Accounts Payable – 1099 Processing WELCOME TO THE ACCOUNTS PAYABLE – 1099 PROCESSING WEBINAR WE WILL.
Understanding the Three Basic Structures
Processing with VSAM Files Please use speaker notes for additional information!
Presented By: Katie, Jake, Janet, Marcellous, and Junaid.
Using ITAMS as a Supervisor or ITAMS Approver Login to ITAMS as usual, at: Enter your User Identification Number (Same as your.
Education Service Center Payroll Time Sheet Instruction Presentation
Touch Screen Time Clock With Great Plains Manufacturing.
Two and three dimension tables Please use speaker notes for additional information!
Time & Labor & Absence Management Entering Time Worked Classified Employee Timesheet.
9/2/20151 Education Service Center Region 10 Payroll Time Sheet Instruction Presentation
Presenters Stephanie Gunderson, El Dorado COE Sherry Lack, Sacramento COE.
NextGen Trustee Department Disbursements This class will cover the various methods of handling department disbursements. Whether entering them manually.
Office of Human Resources Payroll Department Time Entry (DTE) Entering Time 1.
12-1 Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout John.
10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control.
Chapter 13 Sequential File Processing. Master Files Set of files used to store companies data in areas like payroll, inventory Usually processed by batch.
Month End/Year End Procedures VENTUS Presenter: Linda Kennedy.
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.
1 Interactive vs Batch Programs Cobol suited for developing both types of programs Interactive programs Accept input data from keyboard Input data processed.
Printing on power systems Program/ Command Data Report Layout (Printer File) Job Output Queue *FILE Spooled File.
System Development Lifecycle Verification and Validation.
Selection Control Structures. Simple Program Design, Fourth Edition Chapter 4 2 Objectives In this chapter you will be able to: Elaborate on the uses.
6 Chapter 61 Looping Programming Logic and Design, Second Edition, Comprehensive 6.
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)
Sequential Files Chapter 13. Master Files Set of files used to store companies data in areas like payroll, inventory Set of files used to store companies.
PPMS Spring User Group Meeting 5/30/2012 Presented by Susan Engel.
Explanation of SAMPLEIF (if88in1.cbl or if88in1.html) Please use speaker notes for additional information!
Welcome to State of Michigan Time & Expense Processing Employee Travel Requisition With Advance Entry Tutorial Brought to you by the Office of Financial.
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.
Welcome to State of Michigan Time & Expense Processing Employee Expense Modification (No Advance) Tutorial Brought to you by the Office of Financial Management.
COBOL Screens Please use speaker notes for additional information!
CENTURY 21 ACCOUNTING © 2009 South-Western, Cengage Learning LESSON 12-1 Preparing Payroll Time Cards  Paying employees  Analyzing a payroll time card.
13-1 Sequential File Processing Chapter Chapter Contents Overview of Sequential File Processing Sequential File Updating - Creating a New Master.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
1.  Introduction  The Benefits of the Report Writer Module ◦ For Detail and Summary Printing ◦ For Control Break Processing ◦ For Printing Headings.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Chapter 11 Data Validation. Question Should your program assume the data is correct, or should your program edit the data to ensure it is correct?
13- 1 Chapter 13.  Overview of Sequential File Processing  Sequential File Updating - Creating a New Master File  Validity Checking in Update Procedures.
Control Break Processing
Davisware GlobalEdge 2008 Payroll Main Menu Time Entry and Payroll Processing.
People First System Enhancements Release 1 B Manager and Employee Workshop February 2006.
Analysis of SAMPLE1.CBL Please check 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.
Module Three: Identifying your Patient in SIS. Introduction – Search for 1 st T Specimen The Search for 1 st T Specimen screen is used to access your.
Random update Please use speaker notes for additional information!
Sequential Processing to Update a File Please use speaker notes for additional information!
An Introduction to Programming with C++ Sixth Edition Chapter 5 The Selection Structure.
Zortec Payroll. 2 In this session we will cover the basics of LGC’s Zortec Payroll System. Topics include employee master, payroll process setup and processing,
Visual Basic - Break Processing
SERS Per Pay Reporting Beginning 2017.
The Selection Structure
Designing and Debugging Batch and Interactive COBOL Programs
Conditions and Ifs BIS1523 – Lecture 8.
Any Questions?.
Chapter 3 The DATA DIVISION.
NextGen Trustee General Ledger Accounting
Please use speaker notes for additional information!
An Introduction to Structured Program Design in COBOL
Minor, Intermediate and Major Breaks
Searching an Array or Table
Please use speaker notes for additional information!
Any Questions?.
2 file sequential matching with multiple records allowed on file 2
CHAPTER 6 Testing and Debugging.
Presentation transcript:

Edit Programs Please use speaker notes for additional information. Example: payedit.cbl payedit.cbl

The purpose of an EDIT PROGRAM is to check data input and catch errors before they are entered into the system. Edit program input transactions Edit Program good transactions error report

The sample edit program has the following input and output files:  disk file input containing the records to be edited  disk file output containing the records that passed the edit tests and are to become a permanent part of our system  printer file containing the records that were found to contain errors - these records were not written on the disk file output - on our report, each error will printed on a separate line The sample program is editing payroll transactions. Each transaction record is checked for the following:  The first character of the employee id must contain an F, P, C, or T - these are set up with a level 88 for VALID- EMP-CD rather than checking for each letter within the IF statement.  The rest of the id number (4 characters) must be numeric  The work hours must be numeric and cannot be greater than 40  The overtime hours must be numeric and cannot be greater than 20  The sick hours must be numeric and cannot be greater than 40  The vacation hours must be numeric and cannot be greater than 40  The holiday hours must be numeric and cannot be greater than 8  If holiday hours = 0 then the holiday code must be blank. If there are holiday hours than the code must be N, K, M, L, T or C  Bonus pay must be numeric and cannot be greater than 1000  If employee code is F (full-time) than the some of the employee hours (regular, overtime, sick, vacation, and holiday) cannot be less than 40  The sum of the employee hours (regular, overtime, sick, vacation and holiday) cannot exceed 80 Program specifications: payedit.cbl

FD PAYROLL-KEYED DATA RECORD IS PAY-KEYED-REC. 01 PAY-KEYED-REC. 05 EMP-ID. 10 EMP-CD PIC X. 88 VALID-EMP-CD VALUE "F" "P" "C" "T". 10 ID-NO PIC 9(4). 10 RDF-ID-NO REDEFINES ID-NO PIC X(4). 05 WORK-HRS PIC RDF-WORK-HRS REDEFINES WORK-HRS PIC XX. 05 OVT-HRS PIC RDF-OVT-HRS REDEFINES OVT-HRS PIC XX. 05 SICK-HRS PIC RDF-SICK-HRS REDEFINES SICK-HRS PIC XX. 05 VACA-HRS PIC RDF-VACA-HRS REDEFINES VACA-HRS PIC XX. 05 HOLIDAY-HRS PIC RDF-HOLIDAY-HRS REDEFINES HOLIDAY-HRS PIC XX. 05 HOLIDAY-CODE PIC X. 88 VALID-HOLIDAY-CODE VALUES " " "N" "K" "M" "L" "T" "C". 05 BONUS-PAY PIC 9999V RDF-BONUS-PAY REDEFINES BONUS-PAY PIC X(6). F Input data described Data from 1st input record

F Good record This is the first record on the file and it is a valid record as we shall see when we check the tests. IF NOT VALID-EMP-CD MOVE EMP-CD TO DATA-IN-ERR-PR MOVE "INVALID EMP-CD - MUST BE F, P, C OR T" TO ERROR-MSG-PR PERFORM U-100-WRITE-ERROR. IF ID-NO NOT NUMERIC MOVE RDF-ID-NO TO DATA-IN-ERR-PR MOVE "EMPLOYEE NUMBER NOT NUMERIC" TO ERROR-MSG-PR PERFORM U-100-WRITE-ERROR. 05 EMP-ID. 10 EMP-CD PIC X. 88 VALID-EMP-CD VALUE "F" "P" "C" "T". 10 ID-NO PIC 9(4). 10 RDF-ID-NO REDEFINES ID-NO PIC X(4). Note that F is a valid employee code so no error is generated. Note that 1212 is numeric so the record passes the test to make sure that ID-NO is numeric.

Good record F IF WORK-HRS NOT NUMERIC MOVE RDF-WORK-HRS TO DATA-IN-ERR-PR MOVE "WORK HOURS NOT NUMERIC" TO ERROR-MSG-PR PERFORM U-100-WRITE-ERROR ELSE ADD WORK-HRS TO EMP-HRS-WS IF WORK-HRS > 40 MOVE WORK-HRS TO DATA-IN-ERR-PR MOVE "ENTRY IN WORK HOURS EXCEEDS 40" TO ERROR-MSG-PR PERFORM U-100-WRITE-ERROR. Since work hours are numeric and are not greater than 40, the entry is valid.

F Good record IF OVT-HRS NOT NUMERIC MOVE RDF-OVT-HRS TO DATA-IN-ERR-PR MOVE "OVERTIME HOURS NOT NUMERIC" TO ERROR-MSG-PR PERFORM U-100-WRITE-ERROR ELSE ADD OVT-HRS TO EMP-HRS-WS IF OVT-HRS > 20 MOVE OVT-HRS TO DATA-IN-ERR-PR MOVE "OVERTIME HOURS EXCEED 20" TO ERROR-MSG-PR PERFORM U-100-WRITE-ERROR. IF SICK-HRS NOT NUMERIC MOVE RDF-SICK-HRS TO DATA-IN-ERR-PR MOVE "SICK HOURS NOT NUMERIC" TO ERROR-MSG-PR PERFORM U-100-WRITE-ERROR ELSE ADD SICK-HRS TO EMP-HRS-WS IF SICK-HRS > 40 MOVE SICK-HRS TO DATA-IN-ERR-PR MOVE "SICK HOURS GREATER THAN 40" TO ERROR-MSG-PR PERFORM U-100-WRITE-ERROR.

F Good record IF VACA-HRS NOT NUMERIC MOVE RDF-VACA-HRS TO DATA-IN-ERR-PR MOVE "VACATION HOURS NOT NUMERIC" TO ERROR-MSG-PR PERFORM U-100-WRITE-ERROR ELSE ADD VACA-HRS TO EMP-HRS-WS IF VACA-HRS > 40 MOVE VACA-HRS TO DATA-IN-ERR-PR MOVE "VACATION HOURS GREATER THAN 40" TO ERROR-MSG-PR PERFORM U-100-WRITE-ERROR. Note that on each of the hours tests, if the hours are numeric I add them to EMP-HRS-WS. This is happening so that after all of the hours tests, I can check the total number of hours accumulated and see if this number is valid.

Good record F IF HOLIDAY-HRS NOT NUMERIC MOVE RDF-HOLIDAY-HRS TO DATA-IN-ERR-PR MOVE "HOLIDAY HOURS NOT NUMERIC" TO ERROR-MSG-PR PERFORM U-100-WRITE-ERROR ELSE ADD HOLIDAY-HRS TO EMP-HRS-WS IF HOLIDAY-HRS > 8 MOVE HOLIDAY-HRS TO DATA-IN-ERR-PR MOVE "HOLIDAY HOURS GREATER THAN 8" TO ERROR-MSG-PR PERFORM U-100-WRITE-ERROR END-IF IF HOLIDAY-HRS = 0 IF HOLIDAY-CODE = " " NEXT SENTENCE ELSE MOVE HOLIDAY-CODE TO DATA-IN-ERR-PR MOVE "NO HOLIDAY HOURS" TO ERROR-MSG-PR PERFORM U-100-WRITE-ERROR END-IF ELSE IF NOT VALID-HOLIDAY-CODE MOVE HOLIDAY-CODE TO DATA-IN-ERR-PR MOVE "INVALID HOLIDAY CODE - NOT N, K, M, L, T, C" TO ERROR-MSG-PR PERFORM U-100-WRITE-ERROR END-IF END-IF. 05 HOLIDAY-HRS PIC RDF-HOLIDAY-HRS REDEFINES HOLIDAY-HRS PIC XX. 05 HOLIDAY-CODE PIC X. 88 VALID-HOLIDAY-CODE VALUES " " "N" "K" "M" "L" "T" "C".

F Good record IF BONUS-PAY NOT NUMERIC MOVE RDF-BONUS-PAY TO DATA-IN-ERR-PR MOVE "BONUS PAY NOT NUMERIC" TO ERROR-MSG-PR PERFORM U-100-WRITE-ERROR ELSE IF BONUS-PAY > 1000 MOVE BONUS-PAY TO RDF-DATA-IN-ERR-PR MOVE "BONUS PAY OUT OF RANGE - VALID TO 1000" TO ERROR-MSG-PR PERFORM U-100-WRITE-ERROR. IF EMP-CD = "F" AND EMP-HRS-WS < 40 MOVE EMP-HRS-WS TO DATA-IN-ERR-PR MOVE "HOURS WORKED LESS THAN 40" TO ERROR-MSG-PR PERFORM U-100-WRITE-ERROR ELSE IF EMP-HRS-WS > 80 MOVE EMP-HRS-WS TO DATA-IN-ERR-PR MOVE "HOURS WORKED GREATER THAN 80" TO ERROR-MSG-PR PERFORM U-100-WRITE-ERROR. The total hours worked as stored in EMP-HRS-WS is 50 (the sum of 40 regular and 10 hours overtime). This is a valid number of hours.

B-200-LOOP. IF PAGE-NO = 1 OR LNCT > 55 PERFORM B-300-HDR-ROUT. MOVE "NO " TO ERROR-IND. MOVE 0 TO EMP-HRS-WS. PERFORM B-310-EDIT-RECORD IF NO-ERRORS ADD 1 TO NUM-VALID-TRANS MOVE PAY-KEYED-REC TO INFO-FROM-REC MOVE DATE-WS TO DATE-TRAN WRITE PAY-TRAN-REC ELSE ADD 1 TO NUM-INVALID-TRANS. READ PAYROLL-KEYED AT END MOVE "YES" TO EOF-IND. Good record The ERROR-IND is set to NO and the EMP-HRS-WS is set to 0 prior to checking the record. The record is checked - that is what we have seen on the last few slides. We checked each field for validity. Since the data was good, the ERROR-IND did not get changes, it remained set to NO. There were no errors so 1 was added to the NUM-VALID-TRANS and the data was moved to PAY- TRAN-REC and was written to the valid record disk file. FD PAYROLL-TRAN DATA RECORD IS PAY-TRAN-REC. 01 PAY-TRAN-REC. 05 INFO-FROM-REC PIC X(22). 05 DATE-TRAN PIC 9(6). Input Record: F Output Record: F

F T input ID 3/17/99 TRANSACTION EXCEPTION REPORT PAGE 1 ID # DATA ERROR MESSAGE F OVERTIME HOURS EXCEED 20 FD PRINT-FILE DATA RECORD IS PRINTZ. 01 PRINTZ. 05 FILLER PIC X. 05 EMP-ID-PR PIC X(5). 05 FILLER PIC X(5). 05 DATA-IN-ERR-PR PIC X(7). 05 RDF-DATA-IN-ERR-PR REDEFINES DATA-IN-ERR-PR PIC FILLER PIC X(4). 05 ERROR-MSG-PR PIC X(50). 05 FILLER PIC X(8). Invalid record -Output data to the printer input overtime hours LOGIC: LOGIC: IF OVT-HRS > 20 MOVE OVT-HRS TO DATA-IN-ERR-PR MOVE "OVERTIME HOURS EXCEED 20" TO ERROR-MSG-PR PERFORM U-100-WRITE-ERROR.

IF OVT-HRS NOT NUMERIC MOVE RDF-OVT-HRS TO DATA-IN-ERR-PR MOVE "OVERTIME HOURS NOT NUMERIC" TO ERROR-MSG-PR PERFORM U-100-WRITE-ERROR ELSE ADD OVT-HRS TO EMP-HRS-WS IF OVT-HRS > 20 MOVE OVT-HRS TO DATA-IN-ERR-PR MOVE "OVERTIME HOURS EXCEED 20" TO ERROR-MSG-PR PERFORM U-100-WRITE-ERROR. Checking OVT-HRS On the previous slide, we showed the check that produced the error being written to the report. In fact, there are two checks on OVT-HRS. The first checks to see if it is numeric. If it is not numeric the RDF-OVT-HRS which has a picture of XX and can therefore be used when the data contains non-numeric characters is moved to the error line along with an appropriate message. If the OVT-HRS is numeric we then add it to EMP-HRS-WS because we need to check the total hours worked. Notice we need to add the field with the PIC 99. We then check the OVT-HRS to see if it is the correct range - the subject of the previous slide.

U-100-WRITE-ERROR. MOVE EMP-ID TO EMP-ID-PR. WRITE PRINTZ AFTER ADVANCING 1 LINES. ADD 1 TO LNCT. MOVE "YES" TO ERROR-IND. Every time an error is encountered, the data that is in error and an appropriate message are moved to the print line and the routine U-100-WRITE-ERROR is performed. In this routine, the EMP-ID is moved to the line, the line is written and 1 is added to the LNCT and the ERROR-IND is set to YES indicating that an error was found on this record. 05 ERROR-IND PIC XXX VALUE "NO ". 88 THERE-IS-AN-ERROR VALUE "YES". 88 NO-ERRORS VALUE "NO ". The ERROR-IND has two level 88s beneath it. THERE-IS-AN-ERROR is true when the indicator contains YES and NO-ERRORS is true when the indicator contains NO. Setting ERROR-IND

B-200-LOOP. IF PAGE-NO = 1 OR LNCT > 55 PERFORM B-300-HDR-ROUT. MOVE "NO " TO ERROR-IND. MOVE 0 TO EMP-HRS-WS. PERFORM B-310-EDIT-RECORD IF NO-ERRORS ADD 1 TO NUM-VALID-TRANS MOVE PAY-KEYED-REC TO INFO-FROM-REC MOVE DATE-WS TO DATE-TRAN WRITE PAY-TRAN-REC ELSE ADD 1 TO NUM-INVALID-TRANS. READ PAYROLL-KEYED AT END MOVE "YES" TO EOF-IND. B-200-LOOP B-310-EDIT-RECORD is the routine that checks each field on the record for data. When an error is found, the line is written on the report and the ERROR-IND is set to yes. When the B-310-EDIT-RECORD is complete, control returns and the indicator is checked to see if one or more errors was found. This is done with: IF NO-ERRORS IF NO-ERRORS is true, then 1 is added to the number of valid transactions, the data from the input record is moved as a unit to the output record, the date is moved to the output record and the record is written. NOTE: When writing to a disk there is NO after advancing clause - that clause is only for printed reports. If the record is invalid (the error indicator contains YES), then the ELSE is processed and 1 is added to the number of invalid transactions. NOTE: The errors that were found have already been written so no error writing is needed.

Please read the edit notes and analyze the program called payedit.cbl in detail to assure your understanding. conclusion