master file update processing. objectives on completing this section you should be able to: w...

43
Master File Update Processing

Upload: amelia-potter

Post on 18-Jan-2016

213 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Master File Update Processing

Page 2: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

ObjectivesOn completing this section you should be able to:

Distinguish between online processing and batch processing.

Define the terms file maintenance and file maintenance run.

Explain the purpose of a turnaround file. Distinguish between sequential and direct

processing.

Page 3: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Objectives (Continued)

Design an algorithm that updates a sequential master file.

Explain how CASE tools are helping to promote code reusability and thereby increasing programmer productivity.

Page 4: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Introduction

Processing initiated by a user at a terminal or personal computer is said to take place in an online-processing environment.

Online programs are typically independent• input obtained directly from the user.• no other program operates on it beforehand.• output sent directly to user.• output is not used in other programs.

Page 5: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Introduction (Continued)

Programs designed to solve one problem at a time would probably operate in this (online) fashion.• An example might be a program to track the

location of an important package shipped to a customer.

• Another might be to track the value of an investment over time.

Page 6: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Introduction (Continued)

In a typical business, many programs are run on a regularly scheduled basis using large volumes of input.• Large amounts of input are collected and

processed as sets, or batches.• The processing is done by a series of interrelated

programs during a single processing run.• Each series completes one requirement.

Page 7: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Introduction - Batch Processing

The complete series of program forms a system.• Source documents (forms, bills, receipts, etc.)

within the system may be used to create input for one or more programs.

• Output from one program may serve as input to another.

• These programs are said to operate in a batch-processing environment.

Page 8: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

System Flowchart for Billing

CUSTOMERBILLING

DATA

MONTHLYBILLING

PROGRAM

MONTHLYBILL

Page 9: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

File Maintenance

We have seen that a master file is a collection of relatively permanent data.• Even “permanent” data sometimes changes:

• People move.• Prices change.• Salaries are increased.• Job title or classification changes with promotion.

• Update of master files for one or more systems is a process required everywhere.

Page 10: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

File Maintenance (Continued)

Updating a master file is called file maintenance; execution of a program that performs file maintenance is called a file maintenance run.

For example: a publishing company stores the names, addresses, and other information about subscribers in a master name and address file.

Page 11: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

File Maintenance Example

Weekly processing is done for such operations as:• Adding names and addresses of new

subscribers.• Deleting names and addresses of subscribers

whose subscriptions have expired.• Modifying records of current subscribers who

have renewed their subscriptions or changed their address.

Page 12: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

File Maintenance System Flowchart

OLD MASTERN/A FILE

ADJUSTMENTS

MASTER FILEUPDATE

PROGRAM

NEWMASTER

FILE

Page 13: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

System Flowchart

Master file update is performed by a master file update program.

Two inputs to the program:• “Old” (current) master N/A file.• Adjustments file - also known as the

transaction file - containing changes to be made to the master file.

Page 14: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

System Flowchart (Continued)

The update program provides an updated (new) master file.

The new file will be used as input (“old” file) the next time we run this program.

This is called a turnaround file. New master file may also be used as input to

other programs - for example, for a program that prints mailing labels.

Page 15: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Sequential Processing

A major consideration in processing records is the order in which they are processed.

Records in a file stored on magnetic tape need to be processed in the order in which they are stored.• Takes too long to wind tape back and forth to find

the record we want.• Record is accessed only after all the ones preceding

it have been accessed.

Page 16: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Sequential Processing (Continued) This method is called sequential

processing. In order to maximize efficiency of

processing, the records are arranged in order by the value of a field common to all records - a key field.

The key field is typically a part number, employee number, or something similar.

Page 17: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Key Fields Transaction records to be used in sequential

processing with a master file must be arranged (sorted) in order by the same key field as the master file.

Processing compares the transaction key field to the master key field of successive master file records until the key fields match. If records are not in the same order few (if any) matches would occur.

Page 18: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Direct Processing

Master file records can also be stored on disk.

Disk file records can be accessed sequentially or directly. If processed directly, they need not be processed in order.

This is called direct or random processing. Transaction records also need not be sorted.

Page 19: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Sequential Master File Update

Program performs a sequential update procedure.

Assumptions (important):• Master and transaction files are in the same

sequence according to key fields (ID#-M and ID#-T, respectively).

• ID#s read from either file are in the range 1 to 10,000.

• Automatic EOF processing used on both files.

Page 20: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Master File Update (Continued)

Assumptions like this need to be clear in the program design and documentation.

Structure chart - see page 279.• Many modules to this program.• Some modules appear in more than one place.• Reuse of modules like this is highly desirable.

Page 21: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Master File Update Program

Initialization is followed by reading the first record from each input file.

Keys are compared. Three possibilities exist:• Transaction record key is less than the master

file record key. • The transaction record is added to the master file.

• Next transaction record is read.

Page 22: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Master File Update (Continued) Possibilities (continued):

• Transaction record key is equal to the master file record key.

• The master record is deleted or updated.• Next transaction record is read.

• Transaction record key is greater than the master record key.

• No more transactions for this master record.• Output master record to new master file.• Read next master file record.

Page 23: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Master File Update - Details

Overview helps but we need more details, such as:• How do we handle end-of-file processing for

two input files, when we may reach the end of one before the end of the other?

• What types of errors might occur during processing?

Page 24: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Overall Control ProgramA000StartProcess initialization (B000)Read master file (B010)Read transaction file (B020)IF EOF-M = 1 OR EOF-T = 1 THEN WRITE ‘No data’ messageELSE DOWHILE EOF-M = 0 OR EOF-T = 0 Process update (B030) ENDDOENDIFStop

Page 25: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Process Initialization (B000)

B000

Enter

EOF-M = 0

EOF-T = 0

SAVE-FLAG = 0

DELETE-FLAG = 0

Return

Page 26: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Read Master File (B010)B010

Enter

READ Master file record

IF EOF THEN

EOF-M = 1

ID#-M = 99999

(ELSE)

ENDIF

Return

Page 27: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Read Transaction File (B020)B020

Enter

READ Transaction file record

IF EOF THEN

EOF-T = 1

ID#-T = 99999

(ELSE)

ENDIF

Return

Page 28: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Process Update (B030)B030

Enter

DOWHILE ID#-T < ID#-M

Process Trans-key < Master-key (C000)

ENDDO

DOWHILE ID#-T = ID#-M

Process Trans-key = Master-key (C010)

ENDDO

Process Trans-key > Master-key (C020)

Return

Page 29: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Process Trans Key < Master KeyC000

Enter

IF CODE = ‘A’ THEN

Copy master record into save area

Copy trans record into current master record area

SAVE-FLAG = 1

ELSE

WRITE ‘Record does not exist or invalid code’

ENDIF

Read transaction file (B020)

Return

See page 285

Page 30: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Process Trans Key = Master KeyC010EnterCASENTRY CODE CASE ‘C’ Process change (D000) CASE ‘D’ Process delete (D010) CASE ‘A’ Process add (D020) CASE other WRITE ‘Invalid transaction code’ENDCASERead transaction file (B020)Return

Page 31: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Process Trans Key > Master KeyC020EnterIF DELETE-FLAG = 0 THEN WRITE new master recordELSE DELETE-FLAG = 0ENDIFIF SAVE-FLAG = 1 THEN Copy save area into current master record area SAVE-FLAG = 0ELSE Read master file (B010)ENDIFReturn

Page 32: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Process Change

D000

Enter

IF DELETE-FLAG = 0 THEN

Copy transaction record into current master record area

ELSE

WRITE ‘Trying to change a deleted record’

ENDIF

Return

Page 33: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Process Delete

D010

Enter

IF DELETE-FLAG = 0 THEN

DELETE-FLAG = 1

ELSE

WRITE ‘Trying to delete a deleted record.’

ENDIF

Return

Page 34: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Process Add

D020

Enter

IF DELETE-FLAG = 1 THEN

Copy transaction record into current master record area

ELSE

WRITE ‘Trying to add a record that already exists.’

ENDIF

Return

Page 35: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

About Exam 2 ... Open book - you can use:

• Your textbook.

• Your class notes.

• Homework assignments.

Format similar to exam 1 Emphasis on topics covered since exam 1 but you

still need to know all about flowcharts and program structures (to solve the problems).

Page 36: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Topics We’ve Covered

Chapter 6• DOWHILE – Trailer Record Logic

• Trailer record processing• Automatic EOF processing• Headings

Chapter 7• CASE Structure

• Nested IFTHENELSE• How CASE can replace that

Page 37: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Topics We’ve Covered

Chapter 8• DOUNTIL Control Structure• DOUNTIL Counter-Controlled Loops• DOUNTIL vs. DOWHILE

Page 38: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Topics We’ve Covered

Chapter 9• Simple variables vs. subscripted variables• Manipulating single-dimensional arrays (lists)

• Input

• Output

• Other operations (averaging, etc.)

• Manipulating multi-dimensional arrays (tables)• Row-major and column-major ordering

Page 39: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Topics We’ve Covered Chapter 10 (Object-Oriented

Programming)• Object-oriented vs. procedure-oriented design• Terminology: see objectives and key terms• Driver program• Constructor and destructor• Inheritance and polymorphism• Base and derived classes

Page 40: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Topics We Have Covered

Chapter 11 - Array Applications• Loading values into a table• Sequential search of a table• Binary search of a table• Program switches• Sorting values in a table

Page 41: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Topics We Have Covered

Chapter 12 - Master File Update Processing• Online vs. batch processing• File maintenance and file maintenance run• Turnaround file• Sequential vs. direct processing• Update of a sequential master file• Code reusability

Page 42: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Grades and papers

Bring self-addressed stamped envelope for return of papers along with your grade.

Papers are kept on file for one year; records are kept (electronically) for a longer time.

Letter grades depend on your performance relative to the overall class performance.

Page 43: Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing

Thank You for taking this class!