To do that:
1) In your program, open the source code for BINARY or INPUT. BINARY read is a lot faster.
2) In your code, write a sub-routine that parses out all the variables and then eliminates the duplicates. That will leave you with an array filled with unique variables, to compare to your database.
Now writing the code to parse out variables is easy for strings that end in $, or numeric variables that end in %, !, etc. If you have types, DIM variables as strings, or don't use numeric identifiers like %,!, etc., that code gets a lot more complicated to write.
I made a rudimentary variable retrieving routine to help me keep up with the variable names I had in really large programs. It didn't do some of the more complicated stuff I mentioned, so I never published it. Without the more complicated parsing abilities, it just wouldn't be all purpose enough for everyone.
I'm out for a bit, but I'll return to this thread tonight. If it helps, I can dig up what I have, I think I know what computer I have it on, and if you could understand it, you could build on it, if needed.
Of course by posting what I did above, when I come back tonight there will be at least one post with a variable detection routine here, but hey, that's a good thing. I'm not the only genius here.... just the best looking one. :D
Pete