| Company: |
Global Data Processing |
| Objective: |
Generate a new text data file containing latest name/address
information for all customer entries.
|
| Description: |
File1 is an ASCII text data file containing original customer
information. Each record in the file contains a unique reference
number (URN) and corresponding customer name/address details.
(Approx 18 million records in all.)
e.g.
1906872547 Ms Jo Bloggs, 3 New Road, ......
File2 is an ASCII text file with each record containing old
and new name/address details for customers referenced in File1.
Each record includes two URN, one each for the old and new
customer name/address details. Records in File2 are sorted in
ascending order of old URN.
Notes:
- The URN in File1 may match an old URN reference in File2.
- The corresponding new URN in File2 may also match an old URN in another File2 record.
(e.g. where a customer has changed address more than once.)
e.g.
1906872547 Ms Jo Bloggs, 3 New Road, ...... 6528681955 Ms Jo Bloggs, 16 Old Street, ....
6528681955 Ms Jo Bloggs, 16 Old Street, .... 8914276275 Mrs Jo Thomas, 42 Castle View, ...
|
| Solution: |
Since records in File2 are sorted by a unique identifier (the
old data URN), SELCOPY keyed read syntax is used to input
File2 records directly using the old data URN field as the data
key.
-
Read sequentially a record from File1 to obtain the URN key.
-
Use the URN key to perform a keyed (direct) read of the appropriate record in
File2.
- If non-zero new URN exists in the second part of the File2 record,
then use it to perform another keyed read of File2.
- Repeat this until new URN is zero, at which point we have the customer's current details.
e.g.
READ "c:\data\src_addr.txt" INTO 1001 * URN at Position 1001.
...
==LOOP==
READ "c:\data\upd_addr.txt" KEY=10 AT 1001 KEYPOS=1 KEYLEN=10 * Keyed Read using URN.
IF POS NEW_URN <> 0
THEN MOVE 10 AT NEW_URN TO 1001 * New URN Field.
THEN GOTO LOOP * Go back and repeat the keyed Read.
|
| Benefits: |
- SELCOPY's ability to perform direct (i.e. non-sequential) input
of a plain ASCII text file of this size reduces processing
significantly when compared to using alternative solutions.
- This particular job completed in under an hour having processed
over 18 million records. Alternative methods using sequential
input failed to complete and were cancelled after executing for
over 8 hours.
|