You may then need to consider updating the records as you process them. This does not happen at the same time as your retrieval query though. As you loop through the records you've retrieved from the database (presumably with an included criterion of "where dataRead = 'N'), you need to make a database update call for each record processed, setting dataRead = 'Y'.
This is, of course, not a very elegant solution. The data representation in the database becomes dependant on the processing logic of a particular program. What if another program wants to process the same data?
You may consider adding something like timestamp attributes to your database records when they are initially created. The retrieval program could then include all programs from a point in time where it last left off, and store the new time for it's next run, and so forth.
This way the actual data is not geared for any particular program. As an aside, timestamp attributes are always useful in database records for various reasons, including data integrity checks (eg checking whether the data you read from the database has not been modified by another user between the time of your program's read and update database calls)
Hope this helps
