First, thank you all for replying. Hopefully I can clear up any questions. I guess I should have provided more detail sooner.
The program is designed to run 24X7, but may start at any time of the day or night after a power failure, network failure, or a restart after system maintenance. Once the program is running for a while, the issue of computing dates goes away as the TOD in the records coming in will be further away from the starting time of the program and at that point every record it reads will always be after the day the program starts. The problem comes in to play soon after the program starts.
Let's deal with the period of time when the program starts. There may be one or multiple text files that the program has to open up and read. Even after it finishes the file(s) it first encounters, there may be another one coming in a few minutes later. Yes, the program will move any file it processes out of the way so as not to process it again. It's not important to know the TOD of the file itself because each file will have many records within it and each record has a TOD field (only the time and no date). I'm interested only in the TOD field in each record. The TOD field represents the TOD (again, no date) that someone logs into a network and that statistical record is not written to the file until the person logs off. A file is created by the network every 60 minutes and contains a record of anyone who logs off the network in that 60-minute period, even though the user may have been logged on for hours and hours. There is a duration field as well indicating how long the user was logged on. I have not considered this, but perhaps I can make use of that piece of information in my logic. Again, the TOD field represents the TOD (in hh:mm:ss with no date) that the person initially logged on. So you can see that the records are in no specific order and the TOD field may be many hours before the time the person logged off.
Consider these scenarios:
Program Starts at 23:45:00 on Day 0 (the current day).
The text file has five records:
Record 1 has TOD = 22:00:00.
Record 2 has TOD = 23:50:00.
Record 3 has TOD = 00:00:00.
Record 4 has TOD = 00:15:00.
Record 5 has TOD = 11:00:00.
The desired result is that Records 1, 2 and 5 will be Day 0. Records 3 and 4 will be Day 1 (current day plus 1).
Now consider this scenario:
Program starts at 00:15:00 on Day 0.
The text file is the same as above.
In this scenario, the desired result is that Records 1, 2 and 5 will now be Day -1 (current day less 1). Records 3, 4 are now Day 0.
So I think it's more than just knowing if the TOD of a record is less than, equal to, or greater than the Starting time of the program.
Thanks again in advance.
Regards to all.
Elliot