Assignment title: Information
Program 4
For this assignment you will produce a sequential maintenance program using techniques
similar to those in SS3. You are given two files, a "master" file with dealer information called
Account-Master-File-In.txt with record specification of:
01 ACCOUNT-MASTER-RECORD.
05 OM-ACCOUNT-NUMBER PIC X(05).
05 OM-ACCOUNT-NAME PIC X(20).
05 OM-DATE-OF-LAST-DEPOSIT PIC X(8).
05 OM-ACCOUNT-BALANCE PIC S9(6)V99.
and a transaction file called Transaction-File-In.txt with record specification of:
01 MAINTENANCE-TRANSACTION-RECORD.
05 MT-TRANSACTION-CODE PIC X.
88 MT-NEW-ACCOUNT VALUE "1".
88 MT-DEPOSIT VALUE "2".
88 MT-WITHDRAWAL VALUE "3".
88 MT-NAME-CHANGE VALUE "4".
88 MT-DELETION VALUE "5".
05 MT-ACCOUNT-NUMBER PIC X(5).
05 MT-DEPOSIT-AMOUNT PIC 9(6)v99.
05 MT-WITHDRAWAL-AMOUNT
REDEFINES MT-DEPOSIT-AMOUNT
PIC 9(6)V99.
05 MT-DEPOSITOR-NAME-FOR-ADD PIC X(20).
88 MT-DEPOSITOR-NAME-MISSING VALUE SPACES.
01 NAME-CHANGE-RECORD
REDEFINES MAINTENANCE-TRANSACTION-RECORD.
05 PIC X(6).
05 MT-DEPOSITOR-NEW-NAME PIC X(20).
05 PIC X(8).
Your task is to apply the transactions in the transaction file Transaction-File-In.txt to produce
a "new master" called Account-Master-File-Out.txt. Error transactions
should be copied intact to Error-File.txt.
You should use the posted sequential maintenance cobol file discussed in the slides for all
"control" needed. You should use the same name for switches and the control variables.
One change is required in the "control" part of the program in the slides. You should detect
when multiple adds for the same record are attempted. Examination of the old master will
reveal that this occurs for record 371.
With the exception of the multiple add detection, the only modification you
should make is in the data manipulation part of the program.
Note that the Maintenance-Transaction-Record has "formats", i.e. the record can have multiple
structures depending on the type of transaction record it is. There are 5 types of transactions:
adding an account (MT-TRANSACTION-CODE = 1)
deposit into an account (MT-TRANSACTION-CODE = 2)
withdrawal from an account (MT-TRANSACTION-CODE = 3)
changing the name on an account (MT-TRANSACTION-CODE = 4)
deleting an account (MT-TRANSACTION-CODE = 5)
All of the formats have MT-TRANSACTION-CODE and MT-ACCOUNT-NUMBER.
For deposits, the amount deposited is MT-DEPOSIT-AMOUNT.
The REDEFINES MT-DEPOSIT-AMOUNT redefines the storage space for MT-DEPOSIT-AMOUNT
to be called MT-WITHDRAWAL-AMOUNT when the transaction is a withdrawal.
The MT-DEPOSITOR-FOR-ADD is present only for an add transaction, otherwise it is spaces
(because the name for the account does not change for a deposit or withdrawal).
If the transaction is a name change, then the storage space beyond the transaction code and
account number becomes the new name associated with an existing account. 8 spaces is added
after the new name to make the record size 34 characters. This is indicated by NAME-CHANGE-
RECORD which redefines the entire (34 characters) of the MAINTENANCE-TRANSACTION-
RECORD.
Note that all formats end up being 34 characters total.
Note that in the context of the terminology used in the slides, deposits, withdrawals, and name
changes are all "changes", adding an account is an "add", and deleting an account is a "delete".
Note also, that a withdrawal may end up causing an account to have a negative balance. This
will cause strange characters to be printed for the last digit of the balance in the output file
because the negative sign is stored in the same byte as the last digit.