1.5 Batch Processing
1.5 Batch Processing
1.5 Batch Processing
Use:
Batch processing is still used today as it is an effective method of processing large volumes of data; sometimes millions
of transactions are collected over a period of time. The data is entered and processed altogether in one batch by
the computer, which then produces the required results.The processing of one batch is often called a job.
Benefit: Batch processing allows computers to process data when computing resources are not being fully utilized, such as
overnight, and requires very little, and often no, human interaction.
Examples of batch processing include payrolls and customer billing systems. (tell me why ?)
Batch processing benefits: (Important )
- It allows a business to process jobs at the times of day when computer resources are not being used fully, thereby saving the cost of
the computer doing very little.
- Companies are able to make sure that vital tasks which need immediate attention, such as online services, can use the computer
resources as and when needed.
- They can then timetable batch-processing jobs for those times of day when online processing tasks are fewer.
- Compared to real-time processing, batch processing requires a simpler computer system without complex hardware or software.
(why)
- Once the system is up and running, it does not need as much maintenance as a real-time system and, because there is less human
interaction, data entry methods used in batch processing tend to be more accurate
- (list of example) Many utility companies such as water, gas and electricity companies handle huge amounts of data in their billing
systems.
- Batch processing the collection of data, calculating and printing the bills can be done mainly at night, so that the computers can be
used to help control the actual delivery of the utility during the busy part of the day.
Two main files that are used to store data , Master files and transactions files .
A master file usually stores data about a thing such as a person , place or object.
A transaction file usually stores data about an event such as order , electricity and travel expenses .
https://www.youtube.com/watch?v=44fMuzW_e9k
Example:
Payroll System of a company that pays its workers weekly.
Master File
Contains all important data that The transaction file
does not change often such as contains the data that changes each
Name , works number ,
department , hourly late ….etc week, such as hours worked.
1. The master file would already be sorted in order of the key field so that processing is easier to perform.
2. The transaction file would probably be in the order that the transactions were collected.
Before these two files can be processed together to produce the payroll, the transaction file needs to be sorted in the
same order as the master file and will also need to be checked for errors using validation checks.
A master file would be used together with a transaction file in most batch processing applications, including a computerised
When data is stored in order of a key field, it often forms what is called a ‘sequential file’ (Access data types)
These used to be stored on magnetic tapes, but magnetic disks and solid state drives are now used much more than magnetic
tapes, which tend, in modern systems, only to be used for backing up systems. The transaction file will therefore be stored on
disk, even though it holds data in sequential order. When data is searched for in batch processing, each record is looked at
one by one until the computer finds the record it is looking for. This is called sequential access.
There are occasions when the data in a master file has to be updated, for example so that a new worker will get paid. We
will assume that the changes will happen on a weekly basis.
It is likely that the transaction file would contain any needed updates as well as the payroll data and there would only be one
transaction file, but to make it simpler to understand we will assume that the updating of the master file
happens first and then the payroll runs immediately afterwards.
» a new worker starts with the company: their record needs to be added.
We can give each type of update a letter. Changing an existing record in the master file will be C, whereas deleting a record
from the master file will be D and adding a new record to the master file will be A.
At the end of each week, the computer system will process the data stored in the transaction file and make any
changes that are necessary to the master file, thereby producing an updated master file.
tells the algorithm to go back to the REPEAT instruction. It starts again at the ‘IF IDs do not match’ in instruction 5. The IDs
match in this example because the ID is 2 in the transaction file and the ID in the master file record is now 2. Instruction 5 is
therefore ignored and instruction 6 indicates that the transaction is carried out and moves on to instruction 7. In this case the
transaction is D so the record has to be deleted, so the old master file record is not written to the new master file. Instruction
8 is ignored as the transaction is not C. Instruction 9 causes the next record from the transaction file to be read. Instruction 10
means the next record from the master file is read. We again meet the ‘UNTIL end of old master file’ instruction. As the
algorithm has yet to meet the end of file marker, we go back to the REPEAT which is instruction 3. We are now looking at the
second record of the transaction file (ID 4) and the third record of the old master file (ID 3). If they do not match (instruction
5), which they do not, the old master file record is written to the new master file and we jump to instruction 10 and the next
record (the fourth, ID 4) of the old master file is read. We are not at the end of the file, so the algorithm takes us back to
instruction 3 and then on to instruction 4 then instruction 5: the ‘IF IDs do not match’ instruction. However, this master file
record matches with the second record in the transaction file so the transaction is carried out. It is C, so the master file record
is not copied across, instead the record from the transaction file (apart from the C) is copied into the new master file. The next
record from the transaction file is read and then the next record from the master file is read.
The transaction file will contain details of the orders a customer has
made in the last month, together with any payments the customer has
made. We will consider a simple master file which just contains the
money owed by each customer, which is called ‘the balance’.
Teacher: Laila Fakhoury
Again, we can assume that the transaction file is sorted in Cust_no order and has
been validated. The algorithm describing the process would be similar to the
payroll algorithm: