File Conversion
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Time to complete | This is a tough one. Allow 6 hours continuous. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Program Download | FileConv.Cbl is a model answer. Don't look at this until you have made your own attempt at the program. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Example Output |
SClients.Dat (The sorted clients file) Error.Dat (The error file) |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Example Input |
Clients.Dat (The unsorted Client-Names file) |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Major Constructs | Sequential files, SORT with Input Procedure, Pre-Defined Table of values, STRING, UNSTRING, INSPECT, SEARCH ALL | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
IntroductionA program is required to convert the unsorted Client-Names file of free-format,
variable length, records into a sorted file of fixed length records. The
sorted file must be sorted into ascending Client-Name within ascending
County-Name. In addition to converting and sorting the file, the program
must ensure that the county name is valid and must convert it to a county
number. File DescriptionsThe Client-Names File (input)The records of the Client-Names file are unsorted, free-format, variable length records where the fields are separated by commas. While the fields do not occupy specific character positions, they are in a specific order. The Client-Name is first, the Client-Address is next and the Client-Number is last. The fields also have a maximum size. The Client-Name is a maximum of 35 characters, the Address is a maximum of 60 characters long and the Client-Number is always 4 digits long. The constituent parts of the fields are separated by one or more spaces. The fields may be upper case or lower case or a mixture of these. In the Address field the County Name will always be the last part of the address. Some example records are; Michael Terence Ryan,34 Winchester Drive Dublin 3 Co. Dublin,0123 MARY TYLER MOORE,THIS IS AN INVALID ADDRESS,1432 The Sorted-Clients File (output)The Sorted-Clients file is produced from the unsorted Client-Names file. The records of the file must be fixed length records held in ascending Client-Name within ascending County-Num. Each record has the following description.
This file only contains records with valid county names. Records with invalid county names must be written to an error file. The Client-Name in the sorted file must have the surname first so that the sorting will be done correctly. Some sample records are; Hoyle Fred James 17 Starry Lane Cork Co. CORK 060012 Ryan Michael Terence 34 Winchester Drive Dubline 7 Co. Dublin 090123 The Error FileAny records that are found to contain invalid county names are sent to an Error File. This fle has the same format as the input file An example error record is;
AppendixThe names, and corresponding county numbers, of the 32 counties of Ireland
are given in the table below.
Copyright Notice This COBOL project specification is the copyright property of Michael Coughlan. You have permission to use this material for your own personal use but you may not reproduce it in any published work without written permission from the author. |