Introduction
Aromamora PLC sells essential oils to Aromatherapists, Health Shops, Chemists and other retailers. Details of the oils sold are kept in two files:- the Oil-Details-File and the Oil-Stock-File. A program is required which will apply a file of sorted, validated transactions to the Oil-Stock-File and then produce a report based on the contents of both the Oil-Details-File and the Oil-Stock-File.
The report must be printed sequenced on ascending Oil-Name. The report writer must be used to produce the report.
The Transaction File
The Transaction file is a sorted, validated file containing two types of stock movement record. The record types are distinguished from one another by a unique code in the first column of the record. The file has been sorted on ascending Type-Code.
The record descriptions for the Transaction file are as follows;
|
Record Type
|
Field |
Type |
Length |
Value |
| AddToStock | Type Code |
9 |
1 |
1 |
Oil-Number |
9 |
4 |
- |
|
Qty (in units) |
9 |
5 |
1-99999 |
|
| RemoveFromStock | Type Code |
9 |
1 |
2 |
Oil-Number |
9 |
4 |
- |
|
Qty (in units) |
9 |
5 |
1-99999 |
The Oil-Stock-File
The Oil-Stock-File is used to hold details of the current stock levels. It is a relative file containing records with the following description;
|
Field |
KeyType
|
Type |
Length |
Value |
| Oil-Number | Primary |
9 |
4 |
- |
| Qty-In-Stock | -- |
9 |
5 |
1-99999 |
Notes
Only the first three digits of the Oil-Number are the Relative Record Key. The fourth digit is a check digit used to validate the Oil-Number. Before the Oil-Number can be used to access records in the Oil-Stock-File this fourth digit must be stripped off. For instance, to access the record for Oil-Number 0248 only the 024 part of the number can be used as the key.
The Oil-Details-File
The Oil-Details-File is an indexed file containing records with the following description;
|
Field |
KeyType
|
Type |
Length |
Value |
| Oil-Number | Primary |
9 |
4 |
- |
| Oil-Name | Alt with duplicates |
X |
20 |
- |
| Unit-Size | -- |
9 |
2 |
03-90 |
| Unit-Cost | -- |
9 |
4 |
1.50-99.99 |
Validation
Although the Transaction file has been validated, certain errors cannot be detected until an attempt is made to update the Oil-Stock-File. For both types of transaction record, check that the record you are about to update already exists in the Oil-Stock-File. If it does not then the transaction record must be written to an Error-File.
The Oil Stock Report
The Oil Stock Report must be printed after the Oil-Stock-File has been updated. The report must be printed sequenced on ascending Oil-Name.
Numeric values must be printed using comma insertion and either zero suppression or the floating currency symbol.
See the print specification below for more report format details.
| Line 1-2 | Report Heading. To be printed on the first page of the report only. |
| Line 6 | Page-Heading. To be printed at the top of each page. |
| Line 8 |
Detail line. The Oil-Name is suppressed after its first occurrence. Size is the Unit-Size. Qty is the Quantity-In-Stock. Stock-Value is a computed value (Quantity-In-Stock * Unit-Cost). |
| Line 14 | Control Footing. Total-Oil-Value is the sum of the Stock-Values for this oil. |
| Line 24 | Final Control Footing. This is the sum of the Total-Oil-Values. |
