25
10 -1 Chapter 10

10- 1 Chapter 10. To familiarize you with Main types of computer-generated reports Techniques used for efficient printing of group reports and control

Embed Size (px)

Citation preview

Page 1: 10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control

10-1

Chapter 10

Page 2: 10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control

To familiarize you with Main types of computer-generated reports Techniques used for efficient printing of

group reports and control totals Control break processing and control break

printing

10-2

Page 3: 10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control

Detail or Transaction Reports◦ Include one or more lines of output for each input

record read Exception Reports

◦ Printout of individual records that meet (or fail to meet) certain criteria

Summary Reports◦ Summarizes rather than itemizes to provide more

comprehensive information

10-3

Page 4: 10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control

Produces summary report using control fields to indicate when totals are to print

Records with same value for control field grouped together in file

Totals printed for each group of records with same control field value

Break occurs when that field value changes

10-4

Page 5: 10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control

Consider file of sales records, each with three fields: ◦ Salesperson's department number,

salesperson's number, sales amount We’ll make Department number the

control field Records must be in sequence by control

field◦ All records for salespeople in Dept 01 followed

by records for those in Dept 02, …

10-5

Page 6: 10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control

01 12345 09885501 12346 35370001 12347 00349902 12222 98770002 12234 008777

10-6

Amt-Of-Sales-In

SlsNo-In

Dept-In

Page 7: 10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control

Report includes detail printing◦ One line for each record with salesperson's

amount of sales Report also includes summary lines or

group printing ◦ Total line written for each department◦ After all records for Dept 01 read and printed,

total for Dept 01 printed◦ Same is done for Dept 02, and so on

10-7

Page 8: 10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control

Dept Salesperson No Amt of Sales01 12345 $988.5501 12346 $3,537.0001 12347 $34.99Total for Dept is $4,560.54

02 12222 $9,877.0002 12234 $87.77Total for Dept is $9,964.77

10-8

Page 9: 10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control

Records must be in sequence by control field (department number)

Sales records for Dept 01 read in, printed, Dept total accumulated

Continues until record read in with different Dept number

Change in Dept triggers printing of Dept total for Dept 01

10-9

Page 10: 10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control

Single-level means program has only one control field whose value triggers printing of totals

Control break is change in the control field value when a record is read.

10-10

Page 11: 10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control

Many steps (initialization, heading routines) same as previous programs

Detail routine must be modified to check for control breaks

New module added to handle control break processing

10-11

Page 12: 10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control

For first record read, move control field to hold area in WORKING-STORAGE

If control field of subsequent records is same as hold area ◦ Perform detail processing

If they are not equal, control break occurs ◦ Perform control break routine

10-12

Page 13: 10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control

When control field is equal to hold area Add amount to control total Print detail record (if desired) Read next record

10-13

Page 14: 10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control

If control field of record read is not equal to hold area

Print control total for previous group Initialize control total field to zero Reinitialize hold field with new control field

value Perform detail processing as in previous

step

10-14

Page 15: 10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control

First record has no previous control field value for comparison

Add field to use as "flag" to determine if record is first one processed (e.g., First-Record initialized to 'YES')

When record read, if First-Record = 'YES'◦ Save control field value in hold area◦ Turn "off" flag by setting it to 'NO'

10-15

Page 16: 10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control

Totals printed when record with new control field is read

Last group of records has no subsequent record to trigger printing

We need statements in end of job routine to move final group total to output record and print it

Then probably print the grand total

10-16

Page 17: 10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control

May accumulate final total by ◦ Adding amount from each record to control group

total and final total.◦ Adding control group total to final total in control

break routine Second method more efficient since

additions made once for each group instead of once for each record

10-17

Page 18: 10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control

Suppose a sales record is created each time a salesperson makes a sale

Each salesperson may have multiple sales records

Report will include two levels of totals◦ Total sales for each salesperson◦ Total sales for each department

10-18

Page 19: 10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control

Two control fields: Dept-In and SlsNo-In Records sorted by major control field (Dept-

In) then by minor control field (SlsNo-In) Don’t forget about the data needing to be in

order, may have to sort first.

10-19

Page 20: 10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control

Dept-In SlsNo-In Amt-Of-Trans-In01 004 127.2301 004 100.1401 006 027.4501 006 052.2301 006 126.2702 003 111.1402 003 027.23

10-20

2nd level sort

Page 21: 10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control

Two hold areas, one for each control field Check for control break on each

◦ If no change in Dept-In or SlsNo-In, just add Amt-Of-Trans-In to salesperson total

◦ If Dept-In changes, perform major control break routine

◦ If no change in Dept-In but SlsNo-In changes, perform minor control break routine

10-21

Page 22: 10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control

Begins by forcing minor control break◦ This processes last salesperson’s total for

previous department◦ Even if salesperson is the same on the next

record Print department total Reinitialize department total to zero Save new Dept-In in hold area Print heading for new department

10-22

Page 23: 10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control

Print total for previous SlsNo-In Add salesperson total to department total Initialize salesperson total to zero Move new SlsNo-In to hold area

10-23

Page 24: 10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control

Control break program may have any number of control fields

All input records must be in sequence by minor control fields within intermediate control fields within major control fields

Sort file before processing if records are not already in this order

10-24

Page 25: 10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control

Control break routines◦ Higher-level breaks force lower-level breaks◦ Appropriate control total line printed◦ Appropriate control total is initialized◦ Appropriate control field is initialized

10-25