############################################################################## ###!
C###jfffffffffffffffffffffffffffffffffffffffffffffffffffff"###pyr```�� � � � � � �f f f f f f f f f f f f f f f f f f f f f f f f f f ```ld
� � � � � � � � � � � � � � � � � � � �
####hfffffffooo o� ��oo f� �� ����o oo����of�� ������o ffffffff
###jfffffffffffffffffffff fffffffffffffffffffffffffffffff �
####(#f`f�� � � � � � � � � � � � � � � � � � � � � � � � � � �f f f f f f f f f f f f f f f f f f f f f f f f f f ```g######hfffffffff ffffffffo��oo���� ��o oo��offffffffffffffffff
######bf` f f f f f f f f f f� � � � � � � � � � ������� ������� � � � � � � � �o f f f f f f f f f```g######jfffffffffff ffffffo��fofff o f offffffffffffffffffffff"######fbf� � � �� � � � � � � � � � � � � � �f f f f f f f f f f f f f f f f f f f f f f f f f f ```d######hfffffffffffffffffffffffffffffffffffffffffffffffff � � � � � � � � � � � �
ffff
######`fb f f f f f f f f f f f f� � � � � � � � � � � � �� � � � � � � � � � � � � �f f f f f f f f f f f f f f```d######jffffffffff ffffffffff���oo����offfffffffffffffffffff
######fff�� � � � � � � � � � �� ������� � � � � � � � � � �f f f f f f f f f f o f f f f f f f f f f ```h######hffffffffffff ffffffff��fffffff��ffffffffffffffffffffff
######ffb f f f f f f f f f f f f f f f� � � � � � � � � � � � � � � �� � � � � � � � � � �f f f f f f f f f f f```c#(####jffffffffff fffffffffffffffffffffffffffffffffffffffffff"######fff�� � � � � � � � � � � � � � �f f f f f f f f f f f f f f f f f f f f f f f f f f ```j#(###&hfffffffffffffffffffffffffffffff ffffffo ffffffff� � � � � � � � � � � � � � fffff ##
#(#bff f f f f f f f� � � � � � � ���������� � ��� ���� � � � � � � �o f f o f f f f f f f```g######jfffffffffffoo of� ofo f o o ffffffffffff
� �������� � ��� ��
####$#fff�� � � � � � ��� � � � � � � � � �� � � � � � � � � �f f f f f f f f o f f f f f f f f f f f f f f f ```d###f#&hffffffffff ffffffffffffffffffffffffff ffffffffffffffff �
#&#jffffffffffffffffff���ooof�� ������o ffffffffffffffffff"####`#fff�� � � � � � � �f f f f f f f f f o f f f f f f f f f f ```h###&#fhffffffffffffffffff f ffofo o fffffff
� � ����� ������ � � � � � � � � � �� � � ��
fff f f f f f f f f f f f f f f f f f f f f f f f f f f f````####&#jfffffffffffffff� � � � � � � � � � � � � � � � � � � � � � � � � � � f f f f f f f f f ```d#O?f&fhffffffffffffffffffff ffffffffffffffffffffffffffffffff
� � � � � � � � � � �
####
fff f f f f f f f f f f f f f f f f f f f f f f f f f f f```o � � � � � � � � � � � � � � � � � � � � � � � � � � � � �
&f&jffffffffffffffffffff o f o oooffffffffffffffffffff ####
#g
ff��� � � � � � � � � � � � � � � � � � � � � � � � � � �f f f f f f f f f f f f f f f f f f f f f f f f f f ````#��fffhfffffffffffffff fffffo fffffffffffffffffffffffffffffff �
f f f f f f f f f f f f f f f f f f f f� � � � � � � � � � � � � � � � � � � ��� � � � � ��� �f f f f f f f```h#8#fffjffffo��� �� ��o o ####8# f f f f f f f ffffffffffffffffffbfff`f`f`b`b```````````` �������������������� � � � � � � � �
##��######��######��### ##� ��###&##�� ##"##�� #####�� ##@## #� ##### U�
#########AG����� ��############ ##� � �9# A��� �0 ## ############ ##d� � 9##`# P#`#p############# ##d
(##a# # # ############# ##,
9 ### ##### #####3## ## # # #
� � � � � �� � � ��
###��#####�� ��# d#########d#2#######r### Copyright 1997 John Wiley & Sons, Inc. � � All rights reserved. Reproduction or translation of this work beyond that permitted in Section 117 of the 1976 United States Copyright Act without the express written permission of the copyright owner is unlawful. Request for further information should be addressed to the Permissions Department, John Wiley & Sons, Inc. The purchaser may make back-up copies for his/her own use only and not for distribution or resale. The Publisher assumes no responsibility for errors, omissions, or
#r#########r#####
###########r#########r##### #��d#########d#2#######r## ##�
#################$##########################�� ��# d######3##d#########2## ##� �� �M F#�� #### ####T # K######0##d#########Z### Eighth edition Nancy Stern
� �� � ��
#Z#########################################>###############################A####### ########b###############1############### #################Z#############T#
###K######0##d#######R###T# ###K######0##d#######Z###T# ###K######0##d####### ###T#� ###K######0##d#############################################l##?
#########AGp #� � �############ ##|#ࡱ_################r## ##� � �� �- V
,### ##### # d#########d#########/###CHAPTER 13##Sequential File
��� �� �� ��
#/#########/#####,###########/#########/####�� ��# d#########d####################### ############
�� ###
#########AGg #� � ��############ ## # D# A g p� � � � � � ############# ## # x#### ###########r## ## 0 M
� � � � � � �� � ���####��####U �
#
#########
#####,########### #########
####�� ��# d#########d#########2## ##� ���M s#��####��####U �
# ######### ################# #############U# ###K#########d#######$###U# � � � ###K#########d#######=###U# ###K#########d#######N###U#
#########AGg�� S ############ ##� � �
#################,##########################�� ��# d#########d#########2## ##� ����} # #### ####U # K#########d#############Systems Overview of Sequential File � �� �� �� ��
########### ###############################c###########################/###U#n###K#� ########d#######
###U# ###K#########d#######3###U# ###K#########d#######6###U#n###K#########d#######� � ####U# ###K#########d#######/###U# ###K#########d#######+###U# ###K#########d######� � � # ###U# ###K#########d#############################################\##?�
#########AGg S� � # ############ ##� � � O?# A W� ���w
############## ##l#O?#### ###########r## ##� � � �� �p M
#################,##########################�� ��# d#########d#########2## ##� ����= # #### ####U n# K#########d######### ###Validity Checking in Update Procedures
� �� �� � �� �
# ######### ################# #########'###U#n###K#########d###########U# ###K#####� � � � ####d#######M###U# ###K#########d###########U# ###K#########d#######J###U#n###K####� � #####d####### ##################################### # *####!� �
#########AGg #� � ��############ ##� �
O?# A��� �P p############# ## # >#### ###########r## ##� � � � � �� �@ M ,### ##### # d#########d#############CONTENTS
#################,##########################�� ��# d#########d#########2## ##� �� �m } S#��####��####U�� ��# K#########d######### ###Sequential File Updating - �
#########AG���� S ############ ##4� � #Q######## #######r## ###� ��
#.#########.#####,###########.#########.####�� ��# d#########d#######.###+########### ###### ###,###-### **###/############### ################# ####
####�� ��# d#########d#########2## ##� ���M s#��####��####U �
#��K#########d#########A###In most companies, a master file will be stored on a magnetic disk. The features of magnetic media such as disk that make it ideally suited for storing master file data include the following:1. Disks can store
#A#########A#################A#########E###U# ###K#########d#######|###U#
###K#########d#######+###U# ###K#########d#######5###U# ###K#########d####### ###U# ###K#########d#######5###2#########################3###4### ##?�
######## A g p� � � �############# ##� �
O?##AGg #� ���############ ##L#O?#### ###########r## ##� � � �� �0 M $### ##### # d#########d#########
####�� ��# d#########d##### ###2## ##� ���M s#############U#
#{#########{#################{#########s###U# ###K#########d#######a###U# ###K#########d####### ###U# �
#########AGg #� � ��############ ##� �
O?# A g p� � ��############# ##4#O?#### ###########r## ##� � � �� �0 M $### ##### # d#########d#########
####�� ��# d#########d#########2## ##� ���M s#��####��####U �
#��K#########d#########V###Disk files, however, can be organized for either
#V#########V#################V#########O###U# ###K#########d#######]###U# ###K#########d####### ###U# �
#########AG��� S ############ ##D#O?# A� � ���� �############# ##t#g�
# ######### ################# #########E###U# ###K#########d#######U###U# � � � ###K#########d####### ###U# ###K#########d#######S###U# �
*F###K################################# ####
#########AGg #� � ��############ ##D#O?# A g p� � � � �############# ## #g� �
# ######### ################# #########{###U# ###K#########d####### ###U# � � � � ###K#########d#######x###U#
#########AG��� ��############ ## #wt# A g� � � ��
############# ## #wt#### ###########r## ## }
� � � � � ���� f��####��####U �
*T###Y################################# ####
#########AG��� ��############ ## #wt# A g� � � ��
############# ## ## #### ###########r## ## }
� � � � � � ���� f��####��####U �
#I#########I#################I######### ###U# ###K#########d#######[###U# �
###K#########d#######_###\#########################]###^###t# #[###`###############� ################# ####
#########AG7��W S ############ ##D#O?# A� � ����� �# ############# ##D#g�
#:###############$###########################:#########:####�� ��# d#########d##### ###2## ###� ��� � ��# # ####��####U #� ��K#########d######### ###After a master file is � created, a separate procedure is used to make changes to it. Change records are stored in a file referred to as a transaction file, which is also typically stored on disk. Changes to an accounts receivable master file may consist of sales records and credit records. Changes to a payroll master file may consist of name changes, salary changes, etc. Such change records would usually be stored in a disk
# ######### ################# ######### ###U# ###K#########d####### ###U# � � � � � ###K#########d####### ###U# ###K#########d#######k###U# �
*b###g################################# ####
#########AGg #� � ��############ ## #wt# A g p� � � � � ############# ## #wt#### ###########r## ## 0 M
� � � � � �� � ���####��####U �
####################################### ###U# ###K#########d#######u###U# �
#########AGg #� � ��############ ##$# ## A g p� � � � � ############# ## #':#### ###########r## ## 0 M
� � � � � �� �
#### ##### # d#########d#########;###Typical Master File
��� �� �� ��
#;###############$###########################;#########;####�� ��# d#########d####### ##2## ##� ���M s#��####��####U #� ��K#########d######### ###The purpose of �
# ######### ################# #########k###U# ###K#########d#######k###U# � � � ###K#########d####### ###U# ###K#########d#######k###U# �
#########AG#���'
############ ## ##Q################r## ##A # # $### ##### # d#########d###
�� � � � � �� ���� �� �� ��
#5#########5#####,###########5#########5####�� ��# d#########d#######{###x########### ############y###z###
�� �
*w###|################################# ####
#########AGg #� � ��############ ## #wt# A� � �����
###############$########################�� ��# d#########d#########2## ##� ����} # #### ####U # K#########d######### ###Master files that have been
� �� �� � �� �
# ######### ################# ######### ###U# ###K#########d#######� � � � ###U# ###K#########d####### ###U# �
###K#########d####### ###ࡱ#######################l ### ###� � � � *~### ############### ################# ####
#########AGg #� � ��############ ##$# ## A g p� � � � � ############# ##D# ##### ###########r## ## 0 M
� � � � � �� �
#### ##### # d#########d######### ###The Files Used#Input Master File
# ###############$########################### ######### ####�� ��# d#########d#########2## ##� ���M s#��####��####U �
#6#########6#################6#########H###U# ###K#########d#######ࡱ###U# ###K#########d#######o###U#
#########AGg #� � ��############ ##$# ## A g p� � � � � ############# ##\#':#### ###########r## ## 0 M
� � � � �� �
#### ##### # d#########d#########%###The Files Used#Input Transaction
��� �� �� ��
#%###############$###########################%######### %####�� ��# d#########d#########2## ##� ���M s#��####��####U �
#��K#########d######### ###The transaction file contains data to be used for � updating the master file that we call OLD-MASTER. The input transaction file
# ######### ################# #########e###U# ###K#########d#######b###U# � � � ###K#########d###########U#
#########AGg #� � ��############ ##$# ## A g p� � � � � ############# ## # ##### ###########r## ## 0 M
� � � � � � �� �
#### ##### # d#########d#########!###The Files Used#Output Master File#
#!###############$###########################!#########! ####�� ��# d#########d#########2## ##� ���M s#############U#
#######################################V###U# ###K#########d#######t###U# ###K#########d#######O###U#
###K#########d####### ### ######################### ### ###D� � � � # ### ################################# ####
#########AGg #� � ��############ ##D#O?# A g p� � � � �############# ####g�
#-###############$###########################-#########-####�� ��# d#########d#########2## ##� ���M s#��####��####U �
#######################################a###U# ###K#########d###########U#
###K#########d#######&###U# ###K#########d#######*###U# ###K#########d#######9###U# ###K#########d####### ### ######################### ### ###4� � � �
# ### ################################# ####
#########AGg�� ��############ ##l#7B# A g� � ��
############# ##,# 9#### ###########r## ## M
� � � � � ����
#2#########2#####$###########2#########2####�� ��# d#########d#########2## ##� ����M # #### ####U # K#########d#########W###OLD-MASTER contains master
� �� �� � ��
information that was complete and current through the previous updating cycle. The TRANS-FILE contains transactions or changes that have occurred since the previous updating cycle. These transactions or changes must be incorporated into the master file to make it current. The NEW-MASTER will include all OLD-MASTER data in
#W#########W#################W#########k###U# ###K#########d#######g###U#
#########A #� ���0 �############# ## #wt##AGg #� � � � ############ ## ## #### ###########r## ## 0 M
�� � � � � � �� � ���####��####U �
#1#########1#####$###########1#########1####�� ��# d#########d#########2## ##J� ���� �# # #### ####U # K#########d#########$###In a sequential master file, all records
�� �� � ��
are in sequence by a key field, such as account number, social security number, or part number, depending on the type of master file. This key field uniquely
#$#########$#################$######### ###U# ###K#########d#######=###U# �
# ######### ################# #########O###U# ###K#########d#######{###U# � � �
###K#########d#######V###U# ###K#########d#######}###U# ###K#########d####### ###U#� ###K#########d#######k###U#
###K#########d####### ### ######################### ### ###� � � � � # ### ################################# ####
#########AGg #� � ��############ ##$# ## A g #� � � � � 0############# ##t# ##### ###########r## ##� � � � �� �0 M
$### ##### # d#########d#########3###The Procedures Used for
��� �� �� ��
#3#########3#####$###########3#########3####�� ��# d#########d#########2## ##� �� �- M ##��####��####U #� ��K#########d#########<###The Formats for the two input files are:OLD-MASTER-REC TRANS-REC(in sequence by M-ACCT-NO) (in sequence by T-ACCT-NO) 1-5 M-ACCT-NO 1-5 T-ACCT-NO6-11 AMOUNT-DUE 9999V99 6-11 AMT-TRANS-IN- CURRENT-PER 9999V9912-100 FILLER 12-100 FILLEREach transaction record contains the total amount transacted during the current period for a
#########A��� ��# ############# ##D#O?##AGg #� � � ��############ ##T#g�
#3#########3#####$###########3#########3####�� ��# d#########d#########2## ##� #
# ######### ################# ######### ###U# ###K#########d###########U# � � � �
###K#########d###########U# ###K#########d###########U# ###K#########d###########U# ###K#########d##########U#
#########A # @ 0� � � `############# ## #wt##AGg #� � � � ############ ## #wt#### ###########r## ## 0 M
�� � � � � �� � ���####��####U �
#3#########3#####$###########3#########3####�� ��# d#########d#########2## ##J ]� � ��#C# #### ####U # K#########d#########n###The FILLERs may contain additional data
�� �� � ��
#n#########n#################n######### ###U# ###K#########d####### ###U# � � ###K#########d#######1###U#
#########AG��� s ############ ## #wt# A� � � ���� �############# ##4�
# ######### ################# ######### ###U# ###K#########d####### ###U# � � � � �
#########AGg #� � ��############ ##D#O?# A� ����� ############## ##L#O?� ################r## ##� �� � M ���####��#####�� ��# d#########d#########u###The
# ######### ################# #########{###U# ###K#########d#######k###U# � � � ###K#########d####### ###U# �
###K#########d####### ### ######################### ### ###t� � � � # ### ################################# ####
#########AGg #� � ��############ ##D#O?# A g� � �� �############# ##4#O?� #### ###########r## ##� � �� �0 M ���####��#####�� ��# d#########d#########X###The
#X#########3#####$#########
%#################X#########X####�� ��# d#########d#########2## ##� ���M
#############U# ###K#########d######### ###Three possible conditions may be
� �
# ######### ################# #########i###U# ###K#########d#######x###U# � � �
#########AGg C� � # ############ ##D#O?# A 7 0 W� � � � � P############# ##D#g�
#### ###########r## ##� � �� �` M ���####��#####�� ��# d#########d#########Z###The
#######################################I###U# ###K#########d####### ###U# �
#########AG�� �C # ############ ##D#O?# A g 0� � � � � P############# ## #g� �
#### ###########r## ##� � �� �` } ���####��#####�� ��# d#########d#########Y###The
#i#########i#################i######### ###U# ###K#########d####### ###U# � � ###K#########d####### ###U# �
###K#########d####### ### ######################### ### ##### * ### ###############� � � � � � � ################# ####
#########AG���� ��############ ##D#O?# A 7� � ��W �############# ####g�
#### ###########r## ##� � ����} ���####��#####�� ��# d#########d#########V###The
#:###########################################################:######### ###U# � ###K#########d####### ###U# ###K#########d####### ###U# � �
# #########3#####$#########Y################# ######### ####� � � �� ��# d#########d####### ##2## ##� �� �= M ##��####��####U #� ��K#########d#########E###As noted, for some
applications a transaction record with no corresponding master record means a new account. We call this procedure 400-NEW-ACCOUNT in our program. In this instance, a new master record is created entirely from the transaction record. Then the next transaction record is read. We do not read another record from OLD-MASTER at this time, since we have not yet processed the master record that compared greater than T-ACCT-NO. The other
#E#########E#################E#########o###U# ###K#########d####### ###U# � ###K#########d###########U#
#########AG���� ��############ ##D#O?# A g � � � �� @############# ## #g� �
####(###########r## ##� ����} ���####��#####�� ��# d#########d######### ###The �
#######################################Z###U# ###K#########d####### ###U# �
#########AGg�� s ############ ##D#O?# A g� � � �� �############# ##4#O?� ################r## ##� ����M V��####��#####�� ��# d#########d#########c###The
# ######### ################# ######### ###U# ###K#########d###########U# � � � � ###K#########d############################################## A��� �p 0#�
############ ## # 9A###` p # ############ ######################2## ##� � � � � � � � #s
### #########��##3#########.#
#########A @� ���` �############# ## ##W##AGg� � ��� ��############ ##� �
#c#########4#####$#########/#################c#########c####�� ��# d#########d#####&# ##2## ##z� ���& � ��# ####��####U #� ��K#########d#########-###The following examples illustrate the routines to be performed depending on the account numbers read and stored in the input areas:M-ACCT-NO T-ACCT-NO CONDITION ACTION 00001 00001 T-ACCT-NO = M-ACCT-NO 300-REGULAR-UPDATE00002
#########AGg�� c ############ ##D#O?# A g� � � ��� `############# ## #g� �
################r## ##� ���M F��,###��#####�� ��# d#########d######### ###The �
#b#########b#################b#########|###U# ###K#########d####### ###U# � ###K#########d#######Y###U#
#########AG@ `� �
############ ##,#wx#### P# ############# ############## #######r## ##z = &
� � ��� � � � � � �
#
#########
#####,########### #########
#########AGg #� � ��############ ## # x# A g p� � � � � � ############# ## ##u#### ###########r## ## 0 M
� � � � � �� � ���####��####U �
#m#########m#################m#########V###U# ###K#########d###########U#
#########AGg #� � ��############ ## # q# A g p� � � � � � ############# ## # }#### ###########r## ## 0 M
� � � � � � �� �
$### ##### # d#########d#########
#n#########n#################n#########Y###U# ###K#########d###########U#
# ######### #####$########### ######### ####�� ��# d#########d#####+###2## ##� ���M s#��####��####U #� ��K#########d#############3. In a sequential update
#######################################X###U# ###K#########d####### ###U# � ###K#########d#######;###8#########################9###:###|
#########AGg #� � ��############ ## # x# A g p� � � � � � �############# ##d�