Hi,

I am about to change a process that I have been writing recently, and before coding, I thought I would run through the idea here for comments.

The process currently reads two text files, (for example september.txt and august.txt) which contain records in the form of strings. The first file has one field checked which contains a text version of a date, and creates one of three new files. The three new files can have the current month, the previous 12 months [not including the current month] and everything else.

So there is now a new file, (for example OUT_FILE) which contains just september records.

A new check has to be made between OUT_FILE and august.txt on another field which has the text version of an account number. If the acc_id exists in august.txt and not in OUT_FILE, the record is written to a new file, (for example .DEL), if the acc_id exists in OUT_FILE and not in august.txt, the record is written to a new file, (for example .CRE), if the record exists in both files, it is ignored.

I thought of reading both files a record at a time and checking the acc_id's [which are guaranteed to be in numerical ascending order] and comparing their value...

e.g.
Code:
file 1    file 2
 123        123
 124        128
 125        129
 128        130
 129
would be processed like this
Code:
file 1    file 2
 123        123     - 123 = 123 no write
 124        128     - 124 < 128 / 124 to .DEL
 125                - 125 < 128 / 125 to .DEL
 128                - 128 = 128 no write
 129        129     - 129 = 129 no write
            130     - file 1 EOF everything else in file two written to .CRE
Each field value would be sent to an if test for evaluation and then decide on which file the record would be written to.

I am not sure if anyone can see any obvious pitfalls in this ?


tia,