The ultimate goal of this will to be pulling data from a database and creating the binaries on the fly through a series of calculations, and then using this script to determine the next series of data points to pull from the database. (This serves as a filter.)
I have to ask:
"ultimate goal is pulling data from a database"? Then why were you talking about these .txt files in the OP?
"creating the binaries"? What are "binaries"?
Why pull data from a database to do "calculations" (apparently external from the db) when a database can do efficient calculations for you?